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 | 4 | public function __construct(string $content, array $config) |
|
17 | 4 | } |
|
18 | |||
19 | 4 | public function __toString(): string |
|
20 | { |
||
21 | 4 | return $this->content; |
|
22 | } |
||
23 | |||
24 | 4 | public function include() |
|
31 | }; |
||
32 | } |
||
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: