Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

Kunstmaan/AdminListBundle/AdminList/AdminList.php (1 issue)

Upgrade to new PHP Analysis Engine

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;
18
19
    /**
20
     * @var AdminListConfiguratorInterface
21
     */
22
    protected $configurator;
23
24
    /**
25
     * @param AdminListConfiguratorInterface $configurator The configurator
26
     */
27 33
    public function __construct(AdminListConfiguratorInterface $configurator)
28
    {
29 33
        $this->configurator = $configurator;
30 33
        $this->configurator->buildFilters();
31 33
        $this->configurator->buildFields();
32 33
        $this->configurator->buildItemActions();
33 33
        $this->configurator->buildListActions();
34 33
    }
35
36
    /**
37
     * @return AdminListConfiguratorInterface|null
38
     */
39 1
    public function getConfigurator()
40
    {
41 1
        return $this->configurator;
42
    }
43
44
    /**
45
     * @return FilterBuilder
46
     */
47 1
    public function getFilterBuilder()
48
    {
49 1
        return $this->configurator->getFilterBuilder();
50
    }
51
52 1
    public function bindRequest(Request $request)
53
    {
54 1
        $this->configurator->bindRequest($request);
55 1
    }
56
57
    /**
58
     * @return Field[]
59
     */
60 1
    public function getColumns()
61
    {
62 1
        return $this->configurator->getFields();
63
    }
64
65
    /**
66
     * @return Field[]
67
     */
68 1
    public function getExportColumns()
69
    {
70 1
        return $this->configurator->getExportFields();
71
    }
72
73
    /**
74
     * @return int
75
     */
76 1
    public function getCount()
77
    {
78 1
        return $this->configurator->getCount();
79
    }
80
81
    /**
82
     * @return array|null
83
     */
84 1
    public function getItems()
85
    {
86 1
        return $this->configurator->getItems();
87
    }
88
89
    /**
90
     * Return an iterator for all items that matches the current filtering
91
     *
92
     * @return \Iterator
93
     */
94
    public function getIterator()
95
    {
96
        return $this->configurator->getIterator();
97
    }
98
99
    /**
100
     * @param string $columnName
101
     *
102
     * @return bool
103
     */
104 2
    public function hasSort($columnName = null)
105
    {
106 2
        if (\is_null($columnName)) {
107 2
            return \count($this->configurator->getSortFields()) > 0;
108
        }
109
110 1
        return \in_array($columnName, $this->configurator->getSortFields());
111
    }
112
113
    /**
114
     * @param mixed $item
115
     *
116
     * @return bool
117
     */
118 1
    public function canEdit($item)
119
    {
120 1
        return $this->configurator->canEdit($item);
121
    }
122
123
    /**
124
     * @return bool
125
     */
126 1
    public function canAdd()
127
    {
128 1
        return $this->configurator->canAdd();
129
    }
130
131 1
    public function canView($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 @return annotation as described here.

Loading history...
132
    {
133 1
        return $this->configurator->canView($item);
134
    }
135
136
    /**
137
     * @return array
138
     */
139 1
    public function getIndexUrl()
140
    {
141 1
        return $this->configurator->getIndexUrl();
142
    }
143
144
    /**
145
     * @param mixed $item
146
     *
147
     * @return array
148
     */
149 1
    public function getEditUrlFor($item)
150
    {
151 1
        return $this->configurator->getEditUrlFor($item);
152
    }
153
154 1
    public function getViewUrlFor($item)
155
    {
156 1
        return $this->configurator->getViewUrlFor($item);
157
    }
158
159
    /**
160
     * @param mixed $item
161
     *
162
     * @return array
163
     */
164 1
    public function getDeleteUrlFor($item)
165
    {
166 1
        return $this->configurator->getDeleteUrlFor($item);
167
    }
168
169
    /**
170
     * @return array
171
     */
172 1
    public function getAddUrlFor(array $params)
173
    {
174 1
        return $this->configurator->getAddUrlFor($params);
175
    }
176
177
    /**
178
     * @param mixed $item
179
     *
180
     * @return bool
181
     */
182 1
    public function canDelete($item)
183
    {
184 1
        return $this->configurator->canDelete($item);
185
    }
186
187
    /**
188
     * @return bool
189
     */
190 1
    public function canExport()
191
    {
192 1
        return $this->configurator->canExport();
193
    }
194
195
    /**
196
     * @return array
197
     */
198 1
    public function getExportUrl()
199
    {
200 1
        return $this->configurator->getExportUrl();
201
    }
202
203
    /**
204
     * @param object|array $object    The object
205
     * @param string       $attribute The attribute
206
     *
207
     * @return mixed
208
     */
209 1
    public function getValue($object, $attribute)
210
    {
211 1
        return $this->configurator->getValue($object, $attribute);
212
    }
213
214
    /**
215
     * @param object|array $object    The object
216
     * @param string       $attribute The attribute
217
     *
218
     * @return string
219
     */
220 1
    public function getStringValue($object, $attribute)
221
    {
222 1
        return $this->configurator->getStringValue($object, $attribute);
223
    }
224
225
    /**
226
     * @return string
227
     */
228 1
    public function getOrderBy()
229
    {
230 1
        return $this->configurator->getOrderBy();
231
    }
232
233
    /**
234
     * @return string
235
     */
236 1
    public function getOrderDirection()
237
    {
238 1
        return $this->configurator->getOrderDirection();
239
    }
240
241
    /**
242
     * @return array
243
     */
244 1
    public function getItemActions()
245
    {
246 1
        return $this->configurator->getItemActions();
247
    }
248
249
    /**
250
     * @return bool
251
     */
252 1
    public function hasItemActions()
253
    {
254 1
        return $this->configurator->hasItemActions();
255
    }
256
257
    /**
258
     * @return bool
259
     */
260 1
    public function hasListActions()
261
    {
262 1
        return $this->configurator->hasListActions();
263
    }
264
265
    /**
266
     * @return array
267
     */
268 1
    public function getListActions()
269
    {
270 1
        return $this->configurator->getListActions();
271
    }
272
273
    /**
274
     * @return array
275
     */
276 1
    public function getBulkActions()
277
    {
278 1
        return $this->configurator->getBulkActions();
279
    }
280
281
    /**
282
     * @return bool
283
     */
284 1
    public function hasBulkActions()
285
    {
286 1
        return $this->configurator->hasBulkActions();
287
    }
288
289
    /**
290
     * @return Pagerfanta
291
     */
292 1
    public function getPagerfanta()
293
    {
294 1
        return $this->configurator->getPagerfanta();
295
    }
296
}
297