| Conditions | 5 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php namespace Pz\Doctrine\Rest\QueryParser; |
||
| 44 | 14 | public function applyFilter(Criteria $criteria, $filter) |
|
| 45 | { |
||
| 46 | 14 | if (is_string($filter) && is_string($this->property)) { |
|
| 47 | 2 | $criteria->andWhere( |
|
| 48 | 2 | $criteria->expr()->contains($this->property, $filter) |
|
| 49 | ); |
||
| 50 | } |
||
| 51 | |||
| 52 | 14 | if (is_array($filter) && isset($filter[$this->searchKey])) { |
|
| 53 | 1 | $criteria->andWhere( |
|
| 54 | 1 | $criteria->expr()->contains($this->property, $filter[$this->searchKey]) |
|
| 55 | ); |
||
| 56 | } |
||
| 57 | |||
| 58 | 14 | return $criteria; |
|
| 59 | } |
||
| 61 |