| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function getIntermediate() : string { |
||
| 23 | |||
| 24 | if(preg_match_all($this->_pattern, $this->_raw->body, $matches)) { |
||
| 25 | |||
| 26 | $result = ''; |
||
| 27 | |||
| 28 | for($i=1; $i<count($matches[0]); $i++) { |
||
|
|
|||
| 29 | |||
| 30 | $result .= "\n" . $matches[0][$i]; |
||
| 31 | } |
||
| 32 | return $result; |
||
| 33 | } |
||
| 34 | |||
| 35 | throw new \RuntimeException('Preg_match_all has returned false - invalid pattern?'); |
||
| 36 | } |
||
| 56 | } |
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: