Conditions | 4 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 11 |
Ratio | 100 % |
Tests | 6 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
25 | 3 | public function checkCollisionWithCriteria(array $critera): void |
|
26 | { |
||
27 | 3 | foreach ($critera as $criterion) { |
|
28 | 2 | if ($criterion instanceof StartDateCriterion) { |
|
29 | 2 | if ($this->endDate < $criterion->getValue()) { |
|
30 | 1 | throw InvalidQueryException::criteriaCollision('End date must be later than start date'); |
|
31 | } |
||
32 | } |
||
33 | } |
||
34 | 2 | return; |
|
35 | } |
||
36 | |||
42 |
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.