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 Saxulum\PaginationProvider\Twig; |
||
4 | |||
5 | use Saxulum\PaginationProvider\Helper\Processor; |
||
6 | |||
7 | class PaginationExtension extends \Twig_Extension |
||
8 | { |
||
9 | /** |
||
10 | * @var \Twig_Environment |
||
11 | */ |
||
12 | protected $environment; |
||
13 | |||
14 | /** |
||
15 | * @var Processor |
||
16 | */ |
||
17 | protected $processor; |
||
18 | |||
19 | public function __construct(Processor $processor) |
||
20 | { |
||
21 | $this->processor = $processor; |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * {@inheritDoc} |
||
26 | */ |
||
27 | public function initRuntime(\Twig_Environment $environment) |
||
28 | { |
||
29 | $this->environment = $environment; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * {@inheritDoc} |
||
34 | */ |
||
35 | public function getFunctions() |
||
36 | { |
||
37 | return array( |
||
38 | 'knp_pagination_render' => new \Twig_Function_Method($this, 'render', array('is_safe' => array('html'))), |
||
0 ignored issues
–
show
|
|||
39 | 'knp_pagination_sortable' => new \Twig_Function_Method($this, 'sortable', array('is_safe' => array('html'))), |
||
0 ignored issues
–
show
The class
Twig_Function_Method has been deprecated with message: since 1.12 (to be removed in 2.0)
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
40 | 'knp_pagination_filter' => new \Twig_Function_Method($this, 'filter', array('is_safe' => array('html'))), |
||
0 ignored issues
–
show
The class
Twig_Function_Method has been deprecated with message: since 1.12 (to be removed in 2.0)
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
41 | ); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Renders the pagination template |
||
46 | * |
||
47 | * @param string $template |
||
48 | * @param array $queryParams |
||
49 | * @param array $viewParams |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | public function render($pagination, $template = null, array $queryParams = array(), array $viewParams = array()) |
||
54 | { |
||
55 | return $this->environment->render( |
||
56 | $template ?: $pagination->getTemplate(), |
||
57 | $this->processor->render($pagination, $queryParams, $viewParams) |
||
58 | ); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Create a sort url for the field named $title |
||
63 | * and identified by $key which consists of |
||
64 | * alias and field. $options holds all link |
||
65 | * parameters like "alt, class" and so on. |
||
66 | * |
||
67 | * $key example: "article.title" |
||
68 | * |
||
69 | * @param string $title |
||
70 | * @param string $key |
||
71 | * @param array $options |
||
72 | * @param array $params |
||
73 | * @param string $template |
||
74 | * @return string |
||
75 | */ |
||
76 | public function sortable($pagination, $title, $key, $options = array(), $params = array(), $template = null) |
||
77 | { |
||
78 | return $this->environment->render( |
||
79 | $template ?: $pagination->getSortableTemplate(), |
||
80 | $this->processor->sortable($pagination, $title, $key, $options, $params) |
||
81 | ); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Create a filter url for the field named $title |
||
86 | * and identified by $key which consists of |
||
87 | * alias and field. $options holds all link |
||
88 | * parameters like "alt, class" and so on. |
||
89 | * |
||
90 | * $key example: "article.title" |
||
91 | * |
||
92 | * @param string $title |
||
0 ignored issues
–
show
There is no parameter named
$title . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not.
Loading history...
|
|||
93 | * @param string $key |
||
0 ignored issues
–
show
There is no parameter named
$key . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not.
Loading history...
|
|||
94 | * @param array $options |
||
95 | * @param array $params |
||
96 | * @param string $template |
||
97 | * @return string |
||
98 | */ |
||
99 | public function filter($pagination, array $fields, $options = array(), $params = array(), $template = null) |
||
100 | { |
||
101 | return $this->environment->render( |
||
102 | $template ?: $pagination->getFiltrationTemplate(), |
||
103 | $this->processor->filter($pagination, $fields, $options, $params) |
||
104 | ); |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * Get name |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getName() |
||
113 | { |
||
114 | return 'knp_pagination'; |
||
115 | } |
||
116 | } |
||
117 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.