1 | <?php |
||
6 | class FormatingExtension extends \Twig_Extension |
||
7 | { |
||
8 | /** |
||
9 | * @var Validator |
||
10 | */ |
||
11 | private $validator; |
||
12 | |||
13 | /** |
||
14 | * Validator |
||
15 | * |
||
16 | * @param Validator $validator |
||
17 | */ |
||
18 | function __construct(Validator $validator) |
||
22 | |||
23 | /** |
||
24 | * @inherit |
||
25 | */ |
||
26 | public function getFilters() |
||
33 | |||
34 | /** |
||
35 | * String as readable text |
||
36 | * |
||
37 | * @param $v |
||
38 | * @return string |
||
39 | */ |
||
40 | public function textify($v) |
||
44 | |||
45 | /** |
||
46 | * Check value according rule |
||
47 | * |
||
48 | * @param $key |
||
49 | * @param $v |
||
50 | * @return string |
||
51 | */ |
||
52 | public function rule($v, $key) |
||
56 | |||
57 | /** |
||
58 | * @inherit |
||
59 | */ |
||
60 | public function getName() |
||
64 | } |
||
65 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.