| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 2 | public function handle(Query $query) |
|
| 39 | { |
||
| 40 | 2 | if (!($query instanceof SpecificationQuery)) { |
|
| 41 | 1 | return null; |
|
| 42 | } |
||
| 43 | |||
| 44 | /* @var $rep EntitySpecificationRepositoryInterface */ |
||
| 45 | 1 | $rep = $this->em->getRepository($query->entity()); |
|
| 46 | |||
| 47 | 1 | return $rep->match($query->spec(), $query->modifier()); |
|
|
|
|||
| 48 | } |
||
| 49 | } |
||
| 50 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: