| Total Complexity | 6 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | abstract class Extension |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @var string |
||
| 10 | */ |
||
| 11 | protected $buffer; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Extension constructor. |
||
| 15 | * |
||
| 16 | * @param string $buffer |
||
| 17 | */ |
||
| 18 | 3 | public function __construct(string $buffer) |
|
| 19 | { |
||
| 20 | 3 | $this->buffer = $buffer; |
|
| 21 | 3 | } |
|
| 22 | |||
| 23 | /** |
||
| 24 | * @param string $replace |
||
| 25 | * |
||
| 26 | * @return string |
||
| 27 | */ |
||
| 28 | 3 | protected function pattern(string $replace): string |
|
| 29 | { |
||
| 30 | 3 | return '~' . \str_replace('~', '\\~', $replace) . '~ui'; |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param string $replace |
||
| 35 | * @param string $replacement |
||
| 36 | */ |
||
| 37 | 3 | protected function replace(string $replace, string $replacement) |
|
| 38 | { |
||
| 39 | 3 | $this->buffer = \preg_replace( |
|
| 40 | 3 | $this->pattern($replace), |
|
| 41 | 3 | $replacement, |
|
| 42 | 3 | $this->buffer |
|
| 43 | ); |
||
| 44 | 3 | } |
|
| 45 | |||
| 46 | /** |
||
| 47 | * @return void |
||
| 48 | */ |
||
| 49 | 3 | public function apply() |
|
| 54 | } |
||
| 55 | 3 | } |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @return string |
||
| 59 | */ |
||
| 60 | 3 | public function __toString(): string |
|
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @return array |
||
| 67 | */ |
||
| 68 | abstract protected function patterns(): array; |
||
| 69 | |||
| 71 |