1 | <?php |
||
16 | abstract class AbstractRenderer implements ContentRenderInterface |
||
17 | { |
||
18 | private const EVENT_PARSE_BEFORE = 'parse.before'; |
||
19 | private const EVENT_PARSE_AFTER = 'parse.after'; |
||
20 | |||
21 | /** |
||
22 | * @var array|\Closure[] |
||
23 | */ |
||
24 | private $before = []; |
||
25 | |||
26 | /** |
||
27 | * @var array|\Closure[] |
||
28 | */ |
||
29 | private $after = []; |
||
30 | |||
31 | /** |
||
32 | * @param \Closure $callback |
||
33 | * @return $this|ContentRenderInterface |
||
34 | */ |
||
35 | public function before(\Closure $callback): ContentRenderInterface |
||
41 | |||
42 | /** |
||
43 | * @param \Closure $callback |
||
44 | * @return $this|ContentRenderInterface |
||
45 | */ |
||
46 | public function after(\Closure $callback): ContentRenderInterface |
||
52 | |||
53 | /** |
||
54 | * @param string $body |
||
55 | * @return string |
||
56 | */ |
||
57 | protected function fireBefore(string $body): string |
||
65 | |||
66 | /** |
||
67 | * @param string $body |
||
68 | * @return string |
||
69 | */ |
||
70 | protected function fireAfter(string $body): string |
||
78 | |||
79 | /** |
||
80 | * @param string $original |
||
81 | * @param string|mixed $result |
||
82 | * @return string |
||
83 | */ |
||
84 | private function parseEventsOutput(string $original, $result): string |
||
92 | } |
||
93 |