| Total Complexity | 6 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class InheritanceTag extends Tag |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | private $blocks = []; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | private $patternExtends = '/{\s?extends \'?"?(.*?)"?\'?\s?}/is'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * InheritanceTag constructor. |
||
| 23 | * @throws \Exception |
||
| 24 | */ |
||
| 25 | public function __construct() |
||
| 29 | } |
||
| 30 | 4 | ||
| 31 | 4 | /** |
|
| 32 | 4 | * @throws \Exception |
|
| 33 | */ |
||
| 34 | private function extends(): void |
||
| 39 | 4 | } |
|
| 40 | 2 | } |
|
| 41 | 2 | ||
| 42 | private function replaceTag(): void |
||
| 43 | 4 | { |
|
| 44 | foreach ($this->blocks as $key => $value) { |
||
| 45 | 2 | $pattern = '/{\s?block \'?"?' . $key . '"?\'?\s?}(.*?){\s?\/block\s?}/is'; |
|
| 46 | self::$content = preg_replace($pattern, $value, self::$content); |
||
| 47 | 2 | } |
|
| 48 | 2 | ||
| 49 | 2 | self::$content = preg_replace('/{\s?block \'?"?[\w]+"?\'?\s?}/is', '', self::$content); |
|
| 50 | self::$content = preg_replace('/{\s?\/block\s?}/is', '', self::$content); |
||
| 51 | } |
||
| 52 | 2 | ||
| 53 | 2 | public function handle(): string |
|
| 58 | 4 | } |
|
| 59 | } |
||
| 60 |