1 | <?php |
||
27 | class PagerfantaExtension extends \Twig_Extension |
||
28 | { |
||
29 | private $defaultView; |
||
30 | private $viewFactory; |
||
31 | private $router; |
||
32 | private $requestStack; |
||
33 | private $request; |
||
34 | |||
35 | public function __construct($defaultView, ViewFactory $viewFactory, RouterInterface $router, RequestStack $requestStack) |
||
36 | { |
||
37 | $this->defaultView = $defaultView; |
||
38 | $this->viewFactory = $viewFactory; |
||
39 | $this->router = $router; |
||
40 | $this->requestStack = $requestStack; |
||
41 | $this->request = $request; |
||
|
|||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | public function getFunctions() |
||
54 | |||
55 | /** |
||
56 | * Renders a pagerfanta. |
||
57 | * |
||
58 | * @param PagerfantaInterface $pagerfanta The pagerfanta. |
||
59 | * @param string|array $viewName The view name. |
||
60 | * @param array $options An array of options (optional). |
||
61 | * |
||
62 | * @return string The pagerfanta rendered. |
||
63 | */ |
||
64 | public function renderPagerfanta(PagerfantaInterface $pagerfanta, $viewName = null, array $options = array()) |
||
76 | |||
77 | /** |
||
78 | * Generates the url for a given page in a pagerfanta instance. |
||
79 | * |
||
80 | * @param \Pagerfanta\PagerfantaInterface $pagerfanta |
||
81 | * @param $page |
||
82 | * @param array $options |
||
83 | * |
||
84 | * @return string The url of the given page |
||
85 | * |
||
86 | * @throws \InvalidArgumentException |
||
87 | */ |
||
88 | public function getPageUrl(PagerfantaInterface $pagerfanta, $page, array $options = array()) |
||
98 | |||
99 | /** |
||
100 | * Creates an anonymous function which returns the URL for a given page. |
||
101 | * |
||
102 | * @param array $options |
||
103 | * |
||
104 | * @return callable |
||
105 | * |
||
106 | * @throws \Exception |
||
107 | */ |
||
108 | private function createRouteGenerator($options = array()) |
||
152 | |||
153 | public function setRequest(Request $request = null) |
||
157 | |||
158 | /** |
||
159 | * @return Request|null |
||
160 | */ |
||
161 | private function getRequest() |
||
169 | |||
170 | /** |
||
171 | * {@inheritdoc} |
||
172 | */ |
||
173 | public function getName() |
||
177 | } |
||
178 |
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.
The variable may have been renamed without also renaming all references.