| Conditions | 3 |
| Paths | 3 |
| Total Lines | 7 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function include() |
||
| 25 | { |
||
| 26 | if (preg_match_all($this->pattern, $this->content, $matches, PREG_SET_ORDER)) { |
||
| 27 | for ($i = 0; $i < count($matches); $i++) { |
||
|
|
|||
| 28 | $match = $matches[$i]; |
||
| 29 | $replace = file_get_contents("{$this->config['template_dir']}/{$match[1]}.html"); |
||
| 30 | $this->content = str_replace($matches[$i][0], $replace, $this->content); |
||
| 31 | }; |
||
| 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: