These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\AdminListBundle\AdminList; |
||
4 | |||
5 | use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface; |
||
6 | |||
7 | use Pagerfanta\Pagerfanta; |
||
8 | |||
9 | use Symfony\Component\HttpFoundation\Request; |
||
10 | |||
11 | /** |
||
12 | * AdminList |
||
13 | */ |
||
14 | class AdminList |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var Request |
||
19 | */ |
||
20 | protected $request = null; |
||
21 | |||
22 | /** |
||
23 | * @var AdminListConfiguratorInterface |
||
24 | */ |
||
25 | protected $configurator = null; |
||
26 | |||
27 | /** |
||
28 | * @param AdminListConfiguratorInterface $configurator The configurator |
||
29 | */ |
||
30 | public function __construct(AdminListConfiguratorInterface $configurator) |
||
31 | { |
||
32 | $this->configurator = $configurator; |
||
33 | $this->configurator->buildFilters(); |
||
34 | $this->configurator->buildFields(); |
||
35 | $this->configurator->buildItemActions(); |
||
36 | $this->configurator->buildListActions(); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return AdminListConfiguratorInterface|null |
||
41 | */ |
||
42 | public function getConfigurator() |
||
43 | { |
||
44 | return $this->configurator; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return FilterBuilder |
||
49 | */ |
||
50 | public function getFilterBuilder() |
||
51 | { |
||
52 | return $this->configurator->getFilterBuilder(); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @param Request $request |
||
57 | */ |
||
58 | public function bindRequest(Request $request) |
||
59 | { |
||
60 | $this->configurator->bindRequest($request); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @return Field[] |
||
65 | */ |
||
66 | public function getColumns() |
||
67 | { |
||
68 | return $this->configurator->getFields(); |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return Field[] |
||
73 | */ |
||
74 | public function getExportColumns() |
||
75 | { |
||
76 | return $this->configurator->getExportFields(); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @return int |
||
81 | */ |
||
82 | public function getCount() |
||
83 | { |
||
84 | return $this->configurator->getCount(); |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * @return array|null |
||
89 | */ |
||
90 | public function getItems() |
||
91 | { |
||
92 | return $this->configurator->getItems(); |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * Return an iterator for all items that matches the current filtering |
||
97 | * |
||
98 | * @return \Iterator |
||
99 | */ |
||
100 | public function getIterator() |
||
101 | { |
||
102 | return $this->configurator->getIterator(); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * @param string $columnName |
||
107 | * |
||
108 | * @return bool |
||
109 | */ |
||
110 | public function hasSort($columnName = null) |
||
111 | { |
||
112 | if (is_null($columnName)) { |
||
113 | return count($this->configurator->getSortFields()) > 0; |
||
114 | } |
||
115 | return in_array($columnName, $this->configurator->getSortFields()); |
||
116 | } |
||
117 | |||
118 | /** |
||
119 | * @param mixed $item |
||
120 | * |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function canEdit($item) |
||
124 | { |
||
125 | return $this->configurator->canEdit($item); |
||
126 | } |
||
127 | |||
128 | /** |
||
129 | * @return bool |
||
130 | */ |
||
131 | public function canAdd() |
||
132 | { |
||
133 | return $this->configurator->canAdd(); |
||
134 | } |
||
135 | |||
136 | public function canView($item) |
||
0 ignored issues
–
show
|
|||
137 | { |
||
138 | return $this->configurator->canView($item); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * @return array |
||
143 | */ |
||
144 | public function getIndexUrl() |
||
145 | { |
||
146 | return $this->configurator->getIndexUrl(); |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * @param mixed $item |
||
151 | * |
||
152 | * @return array |
||
153 | */ |
||
154 | public function getEditUrlFor($item) |
||
155 | { |
||
156 | return $this->configurator->getEditUrlFor($item); |
||
157 | } |
||
158 | |||
159 | public function getViewUrlFor($item) |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a
Loading history...
|
|||
160 | { |
||
161 | return $this->configurator->getViewUrlFor($item); |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * @param mixed $item |
||
166 | * |
||
167 | * @return array |
||
168 | */ |
||
169 | public function getDeleteUrlFor($item) |
||
170 | { |
||
171 | return $this->configurator->getDeleteUrlFor($item); |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * @param array $params |
||
176 | * |
||
177 | * @return array |
||
178 | */ |
||
179 | public function getAddUrlFor(array $params) |
||
180 | { |
||
181 | return $this->configurator->getAddUrlFor($params); |
||
182 | } |
||
183 | |||
184 | /** |
||
185 | * @param mixed $item |
||
186 | * |
||
187 | * @return bool |
||
188 | */ |
||
189 | public function canDelete($item) |
||
190 | { |
||
191 | return $this->configurator->canDelete($item); |
||
192 | } |
||
193 | |||
194 | /** |
||
195 | * @return bool |
||
196 | */ |
||
197 | public function canExport() |
||
198 | { |
||
199 | return $this->configurator->canExport(); |
||
200 | } |
||
201 | |||
202 | /** |
||
203 | * @return array |
||
204 | */ |
||
205 | public function getExportUrl() |
||
206 | { |
||
207 | return $this->configurator->getExportUrl(); |
||
208 | } |
||
209 | |||
210 | /** |
||
211 | * @param object|array $object The object |
||
212 | * @param string $attribute The attribute |
||
213 | * |
||
214 | * @return mixed |
||
215 | */ |
||
216 | public function getValue($object, $attribute) |
||
217 | { |
||
218 | return $this->configurator->getValue($object, $attribute); |
||
219 | } |
||
220 | |||
221 | /** |
||
222 | * @param object|array $object The object |
||
223 | * @param string $attribute The attribute |
||
224 | * |
||
225 | * @return string |
||
226 | */ |
||
227 | public function getStringValue($object, $attribute) |
||
228 | { |
||
229 | return $this->configurator->getStringValue($object, $attribute); |
||
230 | } |
||
231 | |||
232 | /** |
||
233 | * @return string |
||
234 | */ |
||
235 | public function getOrderBy() |
||
236 | { |
||
237 | return $this->configurator->getOrderBy(); |
||
238 | } |
||
239 | |||
240 | /** |
||
241 | * @return string |
||
242 | */ |
||
243 | public function getOrderDirection() |
||
244 | { |
||
245 | return $this->configurator->getOrderDirection(); |
||
246 | } |
||
247 | |||
248 | /** |
||
249 | * @return array |
||
250 | */ |
||
251 | public function getItemActions() |
||
252 | { |
||
253 | return $this->configurator->getItemActions(); |
||
254 | } |
||
255 | |||
256 | /** |
||
257 | * @return bool |
||
258 | */ |
||
259 | public function hasItemActions() |
||
260 | { |
||
261 | return $this->configurator->hasItemActions(); |
||
262 | } |
||
263 | |||
264 | /** |
||
265 | * @return bool |
||
266 | */ |
||
267 | public function hasListActions() |
||
268 | { |
||
269 | return $this->configurator->hasListActions(); |
||
270 | } |
||
271 | |||
272 | /** |
||
273 | * @return array |
||
274 | */ |
||
275 | public function getListActions() |
||
276 | { |
||
277 | return $this->configurator->getListActions(); |
||
278 | } |
||
279 | |||
280 | /** |
||
281 | * @return array |
||
282 | */ |
||
283 | public function getBulkActions() |
||
284 | { |
||
285 | return $this->configurator->getBulkActions(); |
||
286 | } |
||
287 | |||
288 | /** |
||
289 | * @return bool |
||
290 | */ |
||
291 | public function hasBulkActions() |
||
292 | { |
||
293 | return $this->configurator->hasBulkActions(); |
||
294 | } |
||
295 | |||
296 | /** |
||
297 | * @return Pagerfanta |
||
298 | */ |
||
299 | public function getPagerfanta() |
||
300 | { |
||
301 | return $this->configurator->getPagerfanta(); |
||
302 | } |
||
303 | } |
||
304 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.