1 | <?php |
||
16 | class Extension extends \Twig_Extension |
||
17 | { |
||
18 | /** |
||
19 | * @var Formatter |
||
20 | */ |
||
21 | private $formatter; |
||
22 | |||
23 | /** |
||
24 | * @var Converter |
||
25 | */ |
||
26 | private $converter; |
||
27 | |||
28 | /** |
||
29 | * @var Comparator |
||
30 | */ |
||
31 | private $comparator; |
||
32 | |||
33 | /** |
||
34 | * @param Formatter $formatter |
||
35 | * @param Converter $converter |
||
36 | * @param Comparator $comparator |
||
37 | */ |
||
38 | 14 | public function __construct(Formatter $formatter, Converter $converter, Comparator $comparator) |
|
44 | |||
45 | /** |
||
46 | * @return array |
||
47 | */ |
||
48 | 1 | public function getFilters() |
|
55 | |||
56 | /** |
||
57 | * @return array |
||
58 | */ |
||
59 | 1 | public function getFunctions() |
|
70 | |||
71 | /** |
||
72 | * @param \Twig_Environment $env |
||
73 | * @param mixed $date |
||
74 | * @param string|int|null $format |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | 4 | public function getDateFormat(\Twig_Environment $env, $date, $format = null) |
|
94 | |||
95 | /** |
||
96 | * @param mixed $date |
||
97 | * @param string $time_format |
||
98 | * @param string $month_format |
||
99 | * @param string $year_format |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | 1 | public function getDatePassed( |
|
111 | |||
112 | /** |
||
113 | * @param mixed $x |
||
114 | * @param string $operator |
||
115 | * @param mixed $y |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | 1 | public function getCompareDateTime($x, $operator, $y) |
|
123 | |||
124 | /** |
||
125 | * @param mixed $x |
||
126 | * @param string $operator |
||
127 | * @param mixed $y |
||
128 | * |
||
129 | * @return bool |
||
130 | */ |
||
131 | 1 | public function getCompareDate($x, $operator, $y) |
|
135 | |||
136 | /** |
||
137 | * @param mixed $x |
||
138 | * @param string $operator |
||
139 | * @param mixed $y |
||
140 | * |
||
141 | * @return bool |
||
142 | */ |
||
143 | 1 | public function getCompareTime($x, $operator, $y) |
|
147 | |||
148 | /** |
||
149 | * @param mixed $x |
||
150 | * @param string $operator |
||
151 | * @param mixed $y |
||
152 | * |
||
153 | * @return bool |
||
154 | */ |
||
155 | 1 | public function getCompareWeek($x, $operator, $y) |
|
159 | |||
160 | /** |
||
161 | * @param mixed $x |
||
162 | * @param string $operator |
||
163 | * @param mixed $y |
||
164 | * |
||
165 | * @return bool |
||
166 | */ |
||
167 | 1 | public function getCompareMonth($x, $operator, $y) |
|
171 | |||
172 | /** |
||
173 | * @param mixed $x |
||
174 | * @param string $operator |
||
175 | * @param mixed $y |
||
176 | * |
||
177 | * @return bool |
||
178 | */ |
||
179 | 1 | public function getCompareYear($x, $operator, $y) |
|
183 | |||
184 | /** |
||
185 | * @param mixed $date |
||
186 | * |
||
187 | * @return \DateTime |
||
188 | */ |
||
189 | 9 | private function convert($date) |
|
193 | |||
194 | /** |
||
195 | * @return string |
||
196 | */ |
||
197 | 1 | public function getName() |
|
201 | } |
||
202 |