| Conditions | 2 |
| Paths | 2 |
| Total Lines | 8 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public static function parseFile(string $filename, string $extension): array { |
||
| 14 | $pattern = '/' . self::$delimiter . '(.+?)' . self::$delimiter . '(.+?)' . self::$delimiter . 'end' . self::$delimiter . '/s'; |
||
| 15 | $templateString = self::importFromFile($filename, $extension); |
||
| 16 | \preg_match_all($pattern, $templateString, $templateArray); |
||
| 17 | for ($i = 0; $i < count($templateArray[0]); $i++) { |
||
|
|
|||
| 18 | self::$parsedJs[$templateArray[1][$i]] = $templateArray[2][$i]; |
||
| 19 | } |
||
| 20 | return $templateArray; |
||
| 21 | } |
||
| 28 |
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: