Conditions | 5 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
26 | 3 | public function load(array $options = []) |
|
27 | { |
||
28 | 3 | if (false == isset($options['filters']) || false == is_array($options['filters'])) { |
|
|
|||
29 | 1 | throw new Exception\InvalidArgumentException('Expected filters key and type of array'); |
|
30 | } |
||
31 | |||
32 | 2 | if (false == $options['filters']) { |
|
33 | 1 | throw new Exception\InvalidArgumentException('At least one filter expected'); |
|
34 | } |
||
35 | |||
36 | 1 | $filters = []; |
|
37 | |||
38 | 1 | foreach ($options['filters'] as $loaderName => $loaderOptions) { |
|
39 | 1 | $loader = $this->filterLoaders->get($loaderName); |
|
40 | 1 | $filters[] = $loader->load($loaderOptions); |
|
41 | } |
||
42 | |||
43 | 1 | return new ChainFilter($filters); |
|
44 | |||
45 | } |
||
46 | } |
||
47 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.