Total Complexity | 4 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class page_builder { |
||
11 | public $__root; |
||
12 | |||
13 | public function __construct($templates){ |
||
14 | $this->__root = $templates; |
||
15 | } |
||
16 | |||
17 | function return_template_replace(string $template, array $inputs) { |
||
|
|||
18 | $__template_file = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $this->__root . "/" . $template); |
||
19 | |||
20 | foreach($inputs as $key => $input) { |
||
21 | $__template_file = str_replace("{{" . $key . "}}", $input, $__template_file); |
||
22 | } |
||
23 | |||
24 | return $__template_file; |
||
25 | } |
||
26 | |||
27 | /* Thanks https://stackoverflow.com/questions/1309800/php-eval-that-evaluates-html-php */ |
||
28 | function render($script, array $vars = array()) { |
||
34 | } |
||
35 | } |
||
36 | |||
37 | ?> |
||
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.