| Conditions | 6 |
| Paths | 6 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 53 | public function applyWhereTo($query) |
||
| 54 | { |
||
| 55 | $conditions = []; |
||
| 56 | |||
| 57 | foreach ($this->where as $key => $condition) { |
||
| 58 | foreach ($query->getFields() as $field) { |
||
| 59 | if (is_array($condition)) { |
||
| 60 | throw new InvalidParamException('Condition ' . json_encode($condition) . ' is not supported yet.'); |
||
| 61 | } |
||
| 62 | |||
| 63 | if ($field->nameEquals($key)) { |
||
| 64 | if (!$this->fieldValidatorFactory->createFor($field, 'eq')->validate($condition)) { |
||
| 65 | throw new FieldValidationException('Value ' . $condition . ' is not valid'); |
||
| 66 | } |
||
| 67 | |||
| 68 | $conditions[$field->getSql()] = $condition; |
||
| 69 | } |
||
| 70 | } |
||
| 71 | } |
||
| 72 | |||
| 73 | $query->andWhere($conditions); |
||
| 74 | } |
||
| 75 | } |
||
| 76 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.