| Total Complexity | 5 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 12 | class PaginationSubscriber implements EventSubscriberInterface |
||
| 13 | { |
||
| 14 | protected $defaultLocale; |
||
| 15 | protected $parameterBag; |
||
| 16 | protected $settingsManager; |
||
| 17 | |||
| 18 | public function items(ItemsEvent $event) |
||
| 19 | { |
||
| 20 | if (is_array($event->target)) { |
||
| 21 | $event->items = $event->target; |
||
| 22 | $event->count = count($event->target); |
||
| 23 | $event->stopPropagation(); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | public function pagination(PaginationEvent $event) |
||
| 28 | { |
||
| 29 | if (is_array($event->target)) { |
||
| 30 | $event->setPagination(new SlidingPagination); |
||
| 31 | } |
||
| 32 | |||
| 33 | $event->stopPropagation(); |
||
| 34 | } |
||
| 35 | |||
| 36 | public static function getSubscribedEvents() |
||
| 41 | ]; |
||
| 42 | } |
||
| 43 | } |
||
| 44 |