Conditions | 10 |
Paths | 9 |
Total Lines | 31 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
54 | public function load(array $configs, ContainerBuilder $container) |
||
55 | { |
||
56 | $config = $this->loadConfig($configs, $container); |
||
57 | |||
58 | foreach ($config['extensions'] as $key => $extension) { |
||
59 | if (!isset($extension['enabled']) || $extension['enabled'] !== true) { |
||
60 | continue; |
||
61 | } |
||
62 | if ($this->checkRequirements($key)) { |
||
63 | $iterator = 0; |
||
64 | /** @var $extension array */ |
||
65 | foreach ($extension as $variable => $value) { |
||
66 | $iterator++; |
||
67 | if ($iterator === 1) { |
||
|
|||
68 | $files = [ |
||
69 | 'components.yml', |
||
70 | 'parameters.yml', |
||
71 | 'services.yml', |
||
72 | ]; |
||
73 | $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../'.ucfirst($key).'/Resources/config')); |
||
74 | foreach ($files as $file) { |
||
75 | if (file_exists(__DIR__.'/../'.ucfirst($key).'/Resources/config/'.$file)) { |
||
76 | $loader->load($file); |
||
77 | } |
||
78 | } |
||
79 | } |
||
80 | $container->setParameter($this->getAlias().'.'.$key.'.'.$variable, $config['extensions'][$key][$variable]); |
||
81 | } |
||
82 | if ($component = $this->checkComponent($key)) { |
||
83 | /** @var $component ConfigureInterface */ |
||
84 | $component->configure($container, $this->getAlias()); |
||
85 | } |
||
120 |