Conditions | 5 |
Paths | 10 |
Total Lines | 25 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 5.2 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
25 | 8 | public function __construct( |
|
26 | LoaderResolverInterface $resolver, |
||
27 | array $resources = [], |
||
28 | MethodCollection $collection = null, |
||
29 | array $context = [] |
||
30 | ) |
||
31 | { |
||
32 | 8 | $this->collection = $collection; |
|
33 | |||
34 | 8 | if (null === $this->collection) { |
|
35 | $this->collection = new MethodCollection(); |
||
36 | } |
||
37 | |||
38 | 8 | foreach ($resources as $resource) { |
|
39 | 8 | $loader = $resolver->resolve($resource); |
|
40 | 8 | if (false === $loader) { |
|
41 | throw new \RuntimeException(sprintf('Could not resolve loader for resource "%s"', $resource)); |
||
42 | } |
||
43 | 8 | $this->collection->addCollection($loader->load($resource)); |
|
44 | 8 | } |
|
45 | |||
46 | 8 | foreach ($context as $item) { |
|
47 | 8 | $this->collection->addContext($item); |
|
48 | 8 | } |
|
49 | 8 | } |
|
50 | |||
59 |