| Conditions | 3 |
| Paths | 3 |
| Total Lines | 6 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | private function block(): void |
||
| 28 | { |
||
| 29 | if (preg_match_all($this->patternBlock, $this->content, $matches, PREG_SET_ORDER)) { |
||
| 30 | for ($i = 0; $i < count($matches); $i++) { |
||
|
|
|||
| 31 | $this->blocks[$matches[$i][1]] = $matches[$i][2]; |
||
| 32 | $this->content = str_replace($this->blocks[$matches[$i][1]], '', $this->content); |
||
| 33 | }; |
||
| 55 |
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: