1 | <?php |
||
7 | abstract class AbstractRenderer implements RendererInterface |
||
8 | { |
||
9 | protected $types = []; |
||
10 | |||
11 | protected $preprocessors = []; |
||
12 | |||
13 | 45 | final public function init() |
|
17 | |||
18 | /** |
||
19 | * @return array |
||
20 | */ |
||
21 | 15 | public function getTypes() |
|
25 | |||
26 | /** |
||
27 | * @param string $type |
||
28 | * @param string $key |
||
29 | * @param mixed $value |
||
30 | * @return string|array|boolean rendered item(s) or false on failure |
||
31 | */ |
||
32 | 45 | public function render($type, $key, $value) |
|
48 | |||
49 | /** |
||
50 | * @param string $type |
||
51 | * @param Closure $closure function with one argument: $value |
||
52 | * @return AbstractRenderer |
||
53 | */ |
||
54 | 45 | public function setPreprocessor($type, Closure $closure) |
|
59 | |||
60 | 45 | protected function getPattern($type) |
|
64 | |||
65 | 15 | protected function preprocessValue($key, $value) |
|
73 | |||
74 | abstract protected function initPreprocessors(); |
||
75 | } |
||
76 |