| Total Complexity | 5 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | class Parser { |
||
| 7 | public function parseSource($source) { |
||
| 8 | $tags = static::findTags($source); |
||
|
|
|||
| 9 | foreach ($tags as $rawTag) { |
||
| 10 | $tag = explode(':', $rawTag); |
||
| 11 | $html = call_user_func_array([$this, strtolower($tag[0]) . 'Tag'], array_slice($tag, 1)); |
||
| 12 | $source = str_replace('{' . $rawTag . '}', $html, $source); |
||
| 13 | } |
||
| 14 | return $source; |
||
| 15 | } |
||
| 16 | |||
| 17 | public function findTags($source) { |
||
| 18 | if (!$source) { |
||
| 19 | return []; |
||
| 20 | } |
||
| 21 | |||
| 22 | preg_match_all("|{([^}]+)}|", $source, $result); |
||
| 23 | return $result[1]; |
||
| 24 | } |
||
| 25 | |||
| 26 | public function cutTag($source, $rawTag) { |
||
| 30 | } |
||
| 31 | } |