1 | <?php namespace Nord\Lumen\Search\Adapters; |
||
10 | class QueryAdapter implements SearchAdapterContract |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var QueryBuilder |
||
15 | */ |
||
16 | private $queryBuilder; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $tableAlias; |
||
22 | |||
23 | |||
24 | /** |
||
25 | * QueryAdapter constructor. |
||
26 | * |
||
27 | * @param QueryBuilder $queryBuilder |
||
28 | * @param string $tableAlias |
||
29 | * @param Factory $formatter |
||
30 | */ |
||
31 | public function __construct(QueryBuilder $queryBuilder, $tableAlias, Factory $formatter) |
||
37 | |||
38 | |||
39 | /** |
||
40 | * @param string $format |
||
41 | * @param mixed $value |
||
42 | * |
||
43 | * @return mixed |
||
44 | */ |
||
45 | public function formatValue($format, $value) |
||
49 | |||
50 | |||
51 | /** |
||
52 | * @param string $property |
||
53 | * @param mixed $from |
||
54 | * @param mixed $to |
||
55 | */ |
||
56 | public function applyBetweenFilter($property, $from, $to) |
||
62 | |||
63 | |||
64 | /** |
||
65 | * @param string $property |
||
66 | * @param mixed $value |
||
67 | */ |
||
68 | public function applyNotEqualsFilter($property, $value) |
||
74 | |||
75 | |||
76 | /** |
||
77 | * @param string $property |
||
78 | * @param mixed $value |
||
79 | */ |
||
80 | public function applyGreaterThanFilter($property, $value) |
||
86 | |||
87 | |||
88 | /** |
||
89 | * @param string $property |
||
90 | * @param mixed $value |
||
91 | */ |
||
92 | public function applyLessThanFilter($property, $value) |
||
98 | |||
99 | |||
100 | /** |
||
101 | * @param string $property |
||
102 | * @param mixed $value |
||
103 | */ |
||
104 | public function applyGreaterThanOrEqualsFilter($property, $value) |
||
110 | |||
111 | |||
112 | /** |
||
113 | * @param string $property |
||
114 | * @param mixed $value |
||
115 | */ |
||
116 | public function applyLessThanOrEqualsFilter($property, $value) |
||
122 | |||
123 | |||
124 | /** |
||
125 | * @inheritdoc |
||
126 | */ |
||
127 | public function applyBeginsWithFilter($property, $value) |
||
133 | |||
134 | |||
135 | /** |
||
136 | * @inheritdoc |
||
137 | */ |
||
138 | public function applyEndsWithFilter($property, $value) |
||
144 | |||
145 | |||
146 | /** |
||
147 | * @param string $property |
||
148 | * @param mixed $value |
||
149 | */ |
||
150 | public function applyFreeTextFilter($property, $value) |
||
156 | |||
157 | |||
158 | /** |
||
159 | * @param string $property |
||
160 | * @param mixed $value |
||
161 | */ |
||
162 | public function applyEqualsFilter($property, $value) |
||
168 | |||
169 | |||
170 | /** |
||
171 | * @inheritdoc |
||
172 | */ |
||
173 | public function applySort($property, $direction) |
||
178 | |||
179 | |||
180 | /** |
||
181 | * @inheritdoc |
||
182 | */ |
||
183 | public function getResult() |
||
187 | |||
188 | |||
189 | /** |
||
190 | * @inheritdoc |
||
191 | */ |
||
192 | public function getPartialResult(Pagination $pagination) |
||
205 | } |
||
206 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: