1 | <?php |
||
18 | class MappedOrderByAdapter implements OrderByCriteriaInterface |
||
19 | { |
||
20 | /** |
||
21 | * @var OrderByCriteriaInterface |
||
22 | */ |
||
23 | private $orderBy; |
||
24 | |||
25 | /** |
||
26 | * @var array|\ArrayAccess |
||
27 | */ |
||
28 | private $fieldsMap; |
||
29 | |||
30 | /** |
||
31 | * @param OrderByCriteriaInterface $orderBy |
||
32 | * @param array|\ArrayAccess $fieldsMap keys will be visible to user, |
||
33 | * values to CriteriaBuilder |
||
34 | */ |
||
35 | 11 | public function __construct( |
|
43 | |||
44 | /** |
||
45 | * @return string|null Returns null if user will enter value that is not in fieldsMap |
||
46 | */ |
||
47 | 2 | public function getMappedOrderBy() |
|
55 | |||
56 | /** |
||
57 | * @return array|\ArrayAccess |
||
58 | */ |
||
59 | 1 | public function getFieldsMap() |
|
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | 5 | public function getOrderBy() |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 8 | public function setOrderBy(string $orderBy = null) |
|
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | 6 | public function shouldBeApplied(): bool |
|
87 | |||
88 | /** |
||
89 | * @param mixed $fieldsMap |
||
90 | * |
||
91 | * @throws \InvalidArgumentException |
||
92 | */ |
||
93 | 11 | private function checkFieldsMapType($fieldsMap) |
|
104 | |||
105 | /** |
||
106 | * @return bool |
||
107 | */ |
||
108 | 5 | private function rawValueExistsInFieldsMap(): bool |
|
112 | } |
||
113 |