1 | <?php |
||
14 | class MarkdownRenderer |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $templatePath; |
||
20 | |||
21 | /** |
||
22 | * The Parsedown instance. |
||
23 | * |
||
24 | * @var \Parsedown |
||
25 | */ |
||
26 | protected $parsedown; |
||
27 | |||
28 | /** |
||
29 | * SlimRenderer constructor. |
||
30 | * |
||
31 | * @param string $templatePath |
||
32 | */ |
||
33 | 4 | public function __construct($templatePath = '') |
|
38 | |||
39 | /** |
||
40 | * Render a template. |
||
41 | * |
||
42 | * throws RuntimeException if $templatePath . $template does not exist |
||
43 | * |
||
44 | * @param ResponseInterface $response |
||
45 | * @param string $template |
||
46 | * @param array $data |
||
47 | * |
||
48 | * @return ResponseInterface |
||
49 | * |
||
50 | * @throws \InvalidArgumentException |
||
51 | * @throws \RuntimeException |
||
52 | */ |
||
53 | 2 | public function render(ResponseInterface $response, $template, array $data = []) |
|
61 | |||
62 | /** |
||
63 | * Get the template path. |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 2 | public function getTemplatePath() |
|
68 | { |
||
69 | 2 | return $this->templatePath; |
|
70 | } |
||
71 | |||
72 | /** |
||
73 | * Set the template path. |
||
74 | * |
||
75 | * @param string $templatePath |
||
76 | */ |
||
77 | 1 | public function setTemplatePath($templatePath) |
|
78 | { |
||
79 | 1 | $this->templatePath = $templatePath; |
|
80 | 1 | } |
|
81 | |||
82 | /** |
||
83 | * Renders a template and returns the result as a string. |
||
84 | * |
||
85 | * throws RuntimeException if $templatePath . $template does not exist |
||
86 | * |
||
87 | * @param $template |
||
88 | * @param array $data |
||
89 | * |
||
90 | * @return mixed |
||
91 | * |
||
92 | * @throws \InvalidArgumentException |
||
93 | * @throws \RuntimeException |
||
94 | */ |
||
95 | 2 | public function fetch($template, array $data = []) |
|
104 | } |
||
105 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.