Conditions | 4 |
Paths | 6 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4.25 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
25 | 8 | public function __construct( |
|
26 | LoaderResolverInterface $resolver, |
||
27 | array $resources = [], |
||
28 | MethodCollection $collection = null) |
||
29 | { |
||
30 | 8 | $this->collection = $collection; |
|
31 | |||
32 | 8 | if (null === $this->collection) { |
|
33 | $this->collection = new MethodCollection(); |
||
34 | } |
||
35 | |||
36 | 8 | foreach ($resources as $resource) { |
|
37 | 8 | $loader = $resolver->resolve($resource); |
|
38 | 8 | if (false === $loader) { |
|
39 | throw new \RuntimeException(sprintf('Could not resolve loader for resource "%s"', $resource)); |
||
40 | } |
||
41 | 8 | $this->collection->addCollection($loader->load($resource)); |
|
42 | 8 | } |
|
43 | 8 | } |
|
44 | |||
53 |