Conditions | 4 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 12 |
Ratio | 100 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
68 | 18 | private function checkType($criteria) |
|
69 | { |
||
70 | 18 | if (is_array($criteria) |
|
71 | 18 | || $criteria instanceof \Traversable) { |
|
72 | 8 | return; |
|
73 | } |
||
74 | |||
75 | 10 | throw new \InvalidArgumentException(sprintf( |
|
76 | 10 | 'Provided criteria should be an array or \Traversable object. Given: %s', |
|
77 | 10 | is_object($criteria) ? get_class($criteria) : gettype($criteria) |
|
78 | )); |
||
79 | } |
||
80 | } |
||
81 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.