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