| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 27 | public function isValid(mixed $value, array $context = []): bool |
||
| 28 | { |
||
| 29 | $criteria = $this->getMatchCriteria($value, $context); |
||
| 30 | if (empty($criteria)) { |
||
| 31 | $this->error(self::CRITERIA_EMPTY); |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | // We would like to ensure that the criteria will NOT result in an entity being matched |
||
| 36 | $match = $this->getMatchedEntity($criteria); |
||
| 37 | if (null === $match) { |
||
| 38 | return true; |
||
| 39 | } |
||
| 40 | |||
| 41 | // We matched at least one entity with the provided criteria |
||
| 42 | $this->error(self::IS_MATCH, $criteria); |
||
| 43 | return false; |
||
| 44 | } |
||
| 46 |