1 | <?php |
||
15 | class DataToTwigConvertor |
||
16 | { |
||
17 | /** @var callable */ |
||
18 | private $convertor; |
||
19 | |||
20 | protected function __construct(callable $convertor) |
||
24 | |||
25 | /** |
||
26 | * Data will not be written to the twig template |
||
27 | * |
||
28 | * @return self |
||
29 | */ |
||
30 | public static function nothing(): self |
||
36 | |||
37 | /** |
||
38 | * @psalm-suppress MixedAssignment |
||
39 | * @param bool $force Define the value of the variable even if it is passed to the template |
||
40 | * @return self |
||
41 | */ |
||
42 | public static function vars(bool $force = true): self |
||
56 | |||
57 | /** |
||
58 | * Converts data to one twig variable |
||
59 | * |
||
60 | * @param string $name Variable name |
||
61 | * @param bool $force Define the value of the variable even if it is passed to the template |
||
62 | * @return self |
||
63 | */ |
||
64 | public static function var(string $name, bool $force = true): self |
||
70 | |||
71 | public function convert(array $data): string |
||
77 | |||
78 | /** |
||
79 | * @psalm-suppress MixedAssignment |
||
80 | * @param mixed $value |
||
81 | * @return string |
||
82 | */ |
||
83 | protected static function valueToTwig($value): string |
||
97 | } |
||
98 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.