Total Complexity | 5 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
5 | class IncludeTpl |
||
6 | { |
||
7 | private $content; |
||
8 | private $config; |
||
9 | private $pattern = '/{\s?include \'?"?(.*?)"?\'?\s?}/is'; |
||
10 | |||
11 | public function __construct(string $content, array $config) |
||
12 | { |
||
13 | $this->config = $config; |
||
14 | $this->content = $content; |
||
15 | |||
16 | $this->include(); |
||
17 | } |
||
18 | |||
19 | public function __toString(): string |
||
22 | } |
||
23 | |||
24 | 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: