Conditions | 4 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | static public function parse(string $content, array $placeholders = []) : string |
||
15 | { |
||
16 | foreach ($placeholders as $placeholder => $word) { |
||
17 | |||
18 | if (is_array($placeholder) || is_array($word)) { |
||
19 | throw new \Exception(); |
||
20 | } |
||
21 | |||
22 | $search = sprintf('{{%s}}', $placeholder); |
||
23 | $content = str_replace($search, $word, $content); |
||
24 | } |
||
25 | |||
26 | return $content; |
||
27 | } |
||
28 | } |