| Total Complexity | 5 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class IncludeTpl |
||
| 6 | { |
||
| 7 | private $content; |
||
| 8 | private $config; |
||
| 9 | private $pattern = '/{\s?include \'?"?(.*?)"?\'?\s?}/is'; |
||
| 10 | |||
| 11 | 2 | public function __construct(string $content, array $config) |
|
| 12 | { |
||
| 13 | 2 | $this->config = $config; |
|
| 14 | 2 | $this->content = $content; |
|
| 15 | |||
| 16 | 2 | $this->include(); |
|
| 17 | 2 | } |
|
| 18 | |||
| 19 | 2 | public function __toString(): string |
|
| 22 | } |
||
| 23 | |||
| 24 | 2 | public function include() |
|
| 35 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: