Conditions | 17 |
Paths | 18 |
Total Lines | 32 |
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 |
||
29 | public function process(ContainerBuilder $containerBuilder) |
||
30 | { |
||
31 | $definitions = $containerBuilder->getDefinitions(); |
||
32 | foreach ($definitions as $id => $definition) { |
||
33 | if ( |
||
34 | $id && '.' !== $id[0] |
||
35 | && (!$definition->isPublic() || $definition->isPrivate()) |
||
36 | && !$definition->getErrors() |
||
37 | && !$definition->isAbstract() |
||
38 | ) { |
||
39 | // $definition->setPrivate(false); |
||
40 | // $definition->setPublic(true); |
||
41 | } |
||
42 | } |
||
43 | |||
44 | $aliases = $containerBuilder->getAliases(); |
||
45 | foreach ($aliases as $id => $alias) { |
||
46 | if ($id && '.' !== $id[0] && (!$alias->isPublic() || $alias->isPrivate())) { |
||
47 | while (isset($aliases[$target = (string) $alias])) { |
||
48 | $alias = $aliases[$target]; |
||
49 | } |
||
50 | if ( |
||
51 | isset($definitions[$target]) |
||
52 | && !$definitions[$target]->getErrors() |
||
53 | && !$definitions[$target]->isAbstract() |
||
54 | ) { |
||
55 | // $definition->setPrivate(false); |
||
56 | // $definition->setPublic(true); |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 | } |
||
61 | } |
||
62 |