-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added BaseBundle as main dep - Changed classes to use BaseBundle
- Loading branch information
Showing
33 changed files
with
413 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,4 @@ header: | | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"php":"7.1.18-1+ubuntu18.04.1+deb.sury.org+1","version":"2.11.1:v2.11.1#ad94441c17b8ef096e517acccdbf3238af8a2da8","rules":{"blank_line_after_namespace":true,"braces":{"allow_single_line_closure":true},"class_definition":{"singleLine":true},"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":true,"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"binary_operator_spaces":true,"blank_line_after_opening_tag":true,"blank_line_before_statement":{"statements":["return"]},"cast_spaces":true,"class_attributes_separation":{"elements":["method"]},"concat_space":{"spacing":"none"},"declare_equal_normalize":true,"function_typehint_space":true,"include":true,"increment_style":true,"lowercase_cast":true,"magic_constant_casing":true,"native_function_casing":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["curly_brace_block","extra","parenthesis_brace_block","square_brace_block","throw","use"]},"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":{"use":"echo"},"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":true,"no_unneeded_final_method":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"php_unit_fqcn_annotation":true,"phpdoc_align":{"tags":["method","param","property","return","throws","type","var"]},"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_empty_return":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"protected_to_private":true,"return_type_declaration":true,"semicolon_after_instruction":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_line_comment_style":{"comment_types":["hash"]},"single_quote":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true},"hashes":{"Twig\/MethodAccessorExtension.php":1937766330,"Twig\/AggregationTranslationExtension.php":1168064907,"Twig\/UrlBuilderExtension.php":1238295593,"DependencyInjection\/CompilerPass\/ExporterCompilerPass.php":3859400892,"DependencyInjection\/CompilerPass\/ReadTransformerCompilerPass.php":407060565,"DependencyInjection\/CompilerPass\/WriteTransformerCompilerPass.php":3787221228,"DependencyInjection\/CompilerPass\/RepositoryCompilerPass.php":3492158054,"DependencyInjection\/CompilerPass\/TagCompilerPass.php":1857409043,"DependencyInjection\/ApisearchExtension.php":2861843414,"DependencyInjection\/ApisearchConfiguration.php":2562035961,"ApisearchBundle.php":452340142,"Translator\/AggregationTranslator.php":2950948888,"Command\/ExportIndexCommand.php":3751299339,"Command\/ImportIndexCommand.php":1722481554,"Command\/PrintTokensCommand.php":2265717038,"Command\/DeleteTokensCommand.php":2095195833,"Command\/ApisearchCommand.php":3025110659,"Command\/ApisearchFormattedCommand.php":3372612923,"Command\/AddTokenCommand.php":2707377316,"Command\/WithRepositoryBucketCommand.php":835091977,"Command\/WithAppRepositoryBucketCommand.php":245049441,"Command\/DeleteTokenCommand.php":2469160876,"Command\/CreateIndexCommand.php":3612862136,"Command\/DeleteIndexCommand.php":2188655061,"Command\/ResetIndexCommand.php":4289827141,"Tests\/Functional\/DependencyInjection\/ApisearchConfigurationTest.php":379272062}} | ||
{"php":"7.1.18-1+ubuntu18.04.1+deb.sury.org+1","version":"2.12.2:v2.12.2#dcc87d5414e9d0bd316fce81a5bedb9ce720b183","rules":{"blank_line_after_namespace":true,"braces":{"allow_single_line_closure":true},"class_definition":{"single_line":true},"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":true,"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"binary_operator_spaces":true,"blank_line_after_opening_tag":true,"blank_line_before_statement":{"statements":["return"]},"cast_spaces":true,"class_attributes_separation":{"elements":["method"]},"concat_space":{"spacing":"none"},"declare_equal_normalize":true,"function_typehint_space":true,"include":true,"increment_style":true,"lowercase_cast":true,"lowercase_static_reference":true,"magic_constant_casing":true,"native_function_casing":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["curly_brace_block","extra","parenthesis_brace_block","square_brace_block","throw","use"]},"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":{"use":"echo"},"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":true,"no_unneeded_final_method":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"php_unit_fqcn_annotation":true,"phpdoc_align":{"tags":["method","param","property","return","throws","type","var"]},"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_empty_return":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"protected_to_private":true,"return_type_declaration":true,"semicolon_after_instruction":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_line_comment_style":{"comment_types":["hash"]},"single_quote":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true},"hashes":{"Twig\/MethodAccessorExtension.php":2679933104,"Twig\/AggregationTranslationExtension.php":3642617554,"Twig\/UrlBuilderExtension.php":1291295672,"DependencyInjection\/CompilerPass\/ExporterCompilerPass.php":4087972938,"DependencyInjection\/CompilerPass\/ReadTransformerCompilerPass.php":1677896883,"DependencyInjection\/CompilerPass\/WriteTransformerCompilerPass.php":42015903,"DependencyInjection\/CompilerPass\/RepositoryCompilerPass.php":4290304794,"DependencyInjection\/ApisearchExtension.php":2334454061,"DependencyInjection\/ApisearchConfiguration.php":52611421,"ApisearchBundle.php":3428693615,"Translator\/AggregationTranslator.php":2149846265,"Command\/ExportIndexCommand.php":1299768170,"Command\/ImportIndexCommand.php":2053986604,"Command\/PrintTokensCommand.php":2519214187,"Command\/DeleteTokensCommand.php":3099131500,"Command\/ApisearchCommand.php":2877563410,"Command\/ApisearchFormattedCommand.php":2568151029,"Command\/AddTokenCommand.php":1962164575,"Command\/WithRepositoryBucketCommand.php":3726182334,"Command\/WithAppRepositoryBucketCommand.php":1019748087,"Command\/DeleteTokenCommand.php":1679260907,"Command\/CreateIndexCommand.php":426700519,"Command\/DeleteIndexCommand.php":3216247700,"Command\/ResetIndexCommand.php":2080515326,"Tests\/Functional\/ProductReadTransformer.php":2626856266,"Tests\/Functional\/DependencyInjection\/ApisearchConfigurationTest.php":1733355149,"Tests\/Functional\/DependencyInjection\/CompilerPass\/TransformersCompilerPassTest.php":3384386198,"Tests\/Functional\/ProductBothTransformer.php":867457285,"Tests\/Functional\/ProductWriteTransformer.php":2104628656}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
@@ -21,28 +20,30 @@ | |
use Apisearch\DependencyInjection\CompilerPass\ReadTransformerCompilerPass; | ||
use Apisearch\DependencyInjection\CompilerPass\RepositoryCompilerPass; | ||
use Apisearch\DependencyInjection\CompilerPass\WriteTransformerCompilerPass; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Mmoreram\BaseBundle\BaseBundle; | ||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; | ||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
use Symfony\Component\HttpKernel\KernelInterface; | ||
|
||
/** | ||
* Class ApisearchBundle. | ||
*/ | ||
class ApisearchBundle extends Bundle | ||
class ApisearchBundle extends BaseBundle | ||
{ | ||
/** | ||
* Builds bundle. | ||
* Return a CompilerPass instance array. | ||
* | ||
* @param ContainerBuilder $container Container | ||
* @return CompilerPassInterface[] | ||
*/ | ||
public function build(ContainerBuilder $container) | ||
public function getCompilerPasses(): array | ||
{ | ||
parent::build($container); | ||
|
||
$container->addCompilerPass(new RepositoryCompilerPass()); | ||
$container->addCompilerPass(new ReadTransformerCompilerPass()); | ||
$container->addCompilerPass(new WriteTransformerCompilerPass()); | ||
$container->addCompilerPass(new ExporterCompilerPass()); | ||
return [ | ||
new RepositoryCompilerPass(), | ||
new ReadTransformerCompilerPass(), | ||
new WriteTransformerCompilerPass(), | ||
new ExporterCompilerPass(), | ||
]; | ||
} | ||
|
||
/** | ||
|
@@ -54,4 +55,19 @@ public function getContainerExtension() | |
{ | ||
return new ApisearchExtension(); | ||
} | ||
|
||
/** | ||
* Return all bundle dependencies. | ||
* | ||
* Values can be a simple bundle namespace or its instance | ||
* | ||
* @return array | ||
*/ | ||
public static function getBundleDependencies(KernelInterface $kernel): array | ||
{ | ||
return [ | ||
BaseBundle::class, | ||
FrameworkBundle::class, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,35 +9,21 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Apisearch\DependencyInjection; | ||
|
||
use Apisearch\Http\Retry; | ||
use Mmoreram\BaseBundle\DependencyInjection\BaseConfiguration; | ||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; | ||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
/** | ||
* File header placeholder. | ||
*/ | ||
class ApisearchConfiguration implements ConfigurationInterface | ||
class ApisearchConfiguration extends BaseConfiguration | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder(); | ||
$rootNode = $treeBuilder->root('apisearch'); | ||
$this->setupTree($rootNode); | ||
|
||
return $treeBuilder; | ||
} | ||
|
||
/** | ||
* Configure the root node. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,37 +9,54 @@ | |
* Feel free to edit as you please, and have fun. | ||
* | ||
* @author Marc Morera <[email protected]> | ||
* @author PuntMig Technologies | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Apisearch\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; | ||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | ||
use Mmoreram\BaseBundle\DependencyInjection\BaseExtension; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
/** | ||
* Class ApisearchExtension. | ||
*/ | ||
class ApisearchExtension extends Extension implements PrependExtensionInterface | ||
class ApisearchExtension extends BaseExtension | ||
{ | ||
/** | ||
* Loads a specific configuration. | ||
* Get the Config file location. | ||
* | ||
* @throws \InvalidArgumentException When provided tag is not defined in this extension | ||
* @return string | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container) | ||
protected function getConfigFilesLocation(): string | ||
{ | ||
$loader = new YamlFileLoader( | ||
$container, | ||
new FileLocator(__DIR__.'/../Resources/config') | ||
); | ||
return __DIR__.'/../Resources/config'; | ||
} | ||
|
||
$confiFiles = [ | ||
/** | ||
* Config files to load. | ||
* | ||
* Each array position can be a simple file name if must be loaded always, | ||
* or an array, with the filename in the first position, and a boolean in | ||
* the second one. | ||
* | ||
* As a parameter, this method receives all loaded configuration, to allow | ||
* setting this boolean value from a configuration value. | ||
* | ||
* return array( | ||
* 'file1.yml', | ||
* 'file2.yml', | ||
* ['file3.yml', $config['my_boolean'], | ||
* ... | ||
* ); | ||
* | ||
* @param array $config Config definitions | ||
* | ||
* @return array Config files | ||
*/ | ||
protected function getConfigFiles(array $config): array | ||
{ | ||
return [ | ||
'commands', | ||
'repositories', | ||
'url', | ||
|
@@ -49,33 +66,54 @@ public function load(array $configs, ContainerBuilder $container) | |
'exporters', | ||
'translator', | ||
]; | ||
} | ||
|
||
foreach ($confiFiles as $configFile) { | ||
$loader->load("$configFile.yml"); | ||
} | ||
/** | ||
* Return a new Configuration instance. | ||
* | ||
* If object returned by this method is an instance of | ||
* ConfigurationInterface, extension will use the Configuration to read all | ||
* bundle config definitions. | ||
* | ||
* Also will call getParametrizationValues method to load some config values | ||
* to internal parameters. | ||
* | ||
* @return ConfigurationInterface|null | ||
*/ | ||
protected function getConfigurationInstance(): ? ConfigurationInterface | ||
{ | ||
return new ApisearchConfiguration($this->getAlias()); | ||
} | ||
|
||
/** | ||
* Allow an extension to prepend the extension configurations. | ||
* Load Parametrization definition. | ||
* | ||
* @param ContainerBuilder $container | ||
* return array( | ||
* 'parameter1' => $config['parameter1'], | ||
* 'parameter2' => $config['parameter2'], | ||
* ... | ||
* ); | ||
* | ||
* @param array $config Bundles config values | ||
* | ||
* @return array | ||
*/ | ||
public function prepend(ContainerBuilder $container) | ||
protected function getParametrizationValues(array $config): array | ||
{ | ||
$configurationInstance = new ApisearchConfiguration(); | ||
$configuration = $container->getExtensionConfig('apisearch'); | ||
$configuration = $this->processConfiguration( | ||
$configurationInstance, | ||
$configuration | ||
); | ||
$configuration = $container | ||
->getParameterBag() | ||
->resolveValue($configuration); | ||
return [ | ||
'apisearch.repository_configuration' => $config['repositories'], | ||
]; | ||
} | ||
|
||
$container | ||
->getParameterBag() | ||
->add([ | ||
'apisearch.repository_configuration' => $configuration['repositories'], | ||
]); | ||
/** | ||
* Returns the recommended alias to use in XML. | ||
* | ||
* This alias is also the mandatory prefix to use when using YAML. | ||
* | ||
* @return string The alias | ||
*/ | ||
public function getAlias() | ||
{ | ||
return 'apisearch'; | ||
} | ||
} |
Oops, something went wrong.