Conditions | 3 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 3.1406 |
Changes | 0 |
1 | <?php |
||
42 | 2 | private function setFactories() |
|
43 | { |
||
44 | 2 | foreach ($this->getDiConfig('factories') as $name => $factory) { |
|
45 | $this->container[$name] = function ($container) use ($factory, $name) { |
||
46 | /* @var $container Container */ |
||
47 | |||
48 | if ($container->has($factory)) { |
||
49 | $factory = $container->get($factory); |
||
|
|||
50 | } else { |
||
51 | $factory = new $factory(); |
||
52 | $container[$factory] = $container->protect($factory); |
||
53 | } |
||
54 | |||
55 | return $factory($container, $name); |
||
56 | }; |
||
57 | } |
||
58 | 2 | } |
|
59 | |||
69 |
It seems like you are assigning to a variable which was imported through a
use
statement which was not imported by reference.For clarity, we suggest to use a different name or import by reference depending on whether you would like to have the change visibile in outer-scope.
Change not visible in outer-scope
Change visible in outer-scope