1 | <?php |
||
13 | class Facet |
||
14 | { |
||
15 | /** |
||
16 | * A non-static connection for the current Facet object |
||
17 | * |
||
18 | * @var ConnectionInterface |
||
19 | */ |
||
20 | protected $connection; |
||
21 | |||
22 | /** |
||
23 | * An SQL query that is not yet executed or "compiled" |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $query; |
||
28 | |||
29 | /** |
||
30 | * Array of select elements that will be comma separated. |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $facet = array(); |
||
35 | |||
36 | /** |
||
37 | * BY array to be comma separated |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $by = array(); |
||
42 | |||
43 | /** |
||
44 | * ORDER BY array |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $order_by = array(); |
||
49 | |||
50 | /** |
||
51 | * When not null it adds an offset |
||
52 | * |
||
53 | * @var null|int |
||
54 | */ |
||
55 | protected $offset; |
||
56 | |||
57 | /** |
||
58 | * When not null it adds a limit |
||
59 | * |
||
60 | * @var null|int |
||
61 | */ |
||
62 | protected $limit; |
||
63 | |||
64 | /** |
||
65 | * @param ConnectionInterface|null $connection |
||
66 | */ |
||
67 | public function __construct(ConnectionInterface $connection = null) |
||
71 | |||
72 | /** |
||
73 | * Returns the currently attached connection |
||
74 | * |
||
75 | * @returns ConnectionInterface|null |
||
76 | */ |
||
77 | public function getConnection() |
||
81 | |||
82 | /** |
||
83 | * Sets the connection to be used |
||
84 | * |
||
85 | * @param ConnectionInterface $connection |
||
86 | * @return Facet |
||
87 | */ |
||
88 | public function setConnection(ConnectionInterface $connection = null) |
||
93 | |||
94 | /** |
||
95 | * Facet the columns |
||
96 | * |
||
97 | * Gets the arguments passed as $facet->facet('one', 'two') |
||
98 | * Using it with array maps values as column names |
||
99 | * |
||
100 | * Examples: |
||
101 | * $query->facet('idCategory'); |
||
102 | * // FACET idCategory |
||
103 | * |
||
104 | * $query->facet('idCategory', 'year'); |
||
105 | * // FACET idCategory, year |
||
106 | * |
||
107 | * $query->facet(array('categories' => 'idCategory', 'year', 'type' => 'idType')); |
||
108 | * // FACET idCategory AS categories, year, idType AS type |
||
109 | * |
||
110 | * @param array|string $columns Array or multiple string arguments containing column names |
||
111 | * |
||
112 | * @return Facet |
||
113 | */ |
||
114 | public function facet($columns = null) |
||
134 | |||
135 | /** |
||
136 | * Facet a function |
||
137 | * |
||
138 | * Gets the function passed as $facet->facetFunction('FUNCTION', array('param1', 'param2', ...)) |
||
139 | * |
||
140 | * Examples: |
||
141 | * $query->facetFunction('category'); |
||
142 | * |
||
143 | * @param string $function Function name |
||
144 | * @param array|string $params Array or multiple string arguments containing column names |
||
145 | * |
||
146 | * @return Facet |
||
147 | */ |
||
148 | public function facetFunction($function, $params = null) |
||
158 | |||
159 | /** |
||
160 | * GROUP BY clause |
||
161 | * Adds to the previously added columns |
||
162 | * |
||
163 | * @param string $column A column to group by |
||
164 | * |
||
165 | * @return Facet |
||
166 | */ |
||
167 | public function by($column) |
||
173 | |||
174 | /** |
||
175 | * ORDER BY clause |
||
176 | * Adds to the previously added columns |
||
177 | * |
||
178 | * @param string $column The column to order on |
||
179 | * @param string $direction The ordering direction (asc/desc) |
||
180 | * |
||
181 | * @return Facet |
||
182 | */ |
||
183 | public function orderBy($column, $direction = null) |
||
189 | |||
190 | /** |
||
191 | * Facet a function |
||
192 | * |
||
193 | * Gets the function passed as $facet->facetFunction('FUNCTION', array('param1', 'param2', ...)) |
||
194 | * |
||
195 | * Examples: |
||
196 | * $query->facetFunction('category'); |
||
197 | * |
||
198 | * @param string $function Function name |
||
199 | * @param array $params Array string arguments containing column names |
||
200 | * @param string $direction The ordering direction (asc/desc) |
||
201 | * |
||
202 | * @return Facet |
||
203 | */ |
||
204 | public function orderByFunction($function, $params = null, $direction = null) |
||
214 | |||
215 | /** |
||
216 | * LIMIT clause |
||
217 | * Supports also LIMIT offset, limit |
||
218 | * |
||
219 | * @param int $offset Offset if $limit is specified, else limit |
||
220 | * @param null|int $limit The limit to set, null for no limit |
||
221 | * |
||
222 | * @return Facet |
||
223 | */ |
||
224 | public function limit($offset, $limit = null) |
||
236 | |||
237 | /** |
||
238 | * OFFSET clause |
||
239 | * |
||
240 | * @param int $offset The offset |
||
241 | * |
||
242 | * @return Facet |
||
243 | */ |
||
244 | public function offset($offset) |
||
250 | |||
251 | /** |
||
252 | * Compiles the statements for FACET |
||
253 | * |
||
254 | * @return Facet |
||
255 | * @throws SphinxQLException In case no column in facet |
||
256 | */ |
||
257 | public function compileFacet() |
||
312 | |||
313 | /** |
||
314 | * Get String with SQL facet |
||
315 | * |
||
316 | * @return string |
||
317 | */ |
||
318 | public function getFacet() |
||
322 | } |
||
323 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..