| Total Complexity | 6 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 5 | final class Constraint implements ConstraintInterface |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var string[] |
||
| 9 | */ |
||
| 10 | private array $orders = []; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var string[] |
||
| 14 | */ |
||
| 15 | private array $filters = []; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * {@inheritdoc} |
||
| 19 | */ |
||
| 20 | public function setOrders(array $orders): void |
||
| 21 | { |
||
| 22 | $this->orders = $orders; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * {@inheritdoc} |
||
| 27 | */ |
||
| 28 | public function isAllowedOrder(string $fieldName): bool |
||
| 29 | { |
||
| 30 | return empty($this->orders) || \in_array($fieldName, $this->orders, true); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritdoc} |
||
| 35 | */ |
||
| 36 | public function setFilters(array $filters): void |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * {@inheritdoc} |
||
| 43 | */ |
||
| 44 | public function isAllowedFilter(string $fieldName): bool |
||
| 49 |