| Conditions | 7 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 7.6383 |
| Changes | 0 | ||
| 1 | <?php |
||
| 82 | 12 | public function moveNext() |
|
| 83 | { |
||
| 84 | 12 | if ($this->hasNext()) { |
|
| 85 | 12 | $cols = preg_split($this->fieldexpression, $this->currentBuffer, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
| 86 | |||
| 87 | 12 | $sr = new Row(); |
|
| 88 | |||
| 89 | 12 | for ($i = 0; ($i < count($this->fields)) && ($i < count($cols)); $i++) { |
|
| 90 | 12 | $column = $cols[$i]; |
|
| 91 | |||
| 92 | 12 | if (($i >= count($this->fields) - 1) || ($i >= count($cols) - 1)) { |
|
| 93 | 12 | $column = preg_replace("/(\r?\n?)$/", "", $column); |
|
| 94 | 12 | } |
|
| 95 | |||
| 96 | 12 | $sr->addField(strtolower($this->fields[$i]), $column); |
|
| 97 | 12 | } |
|
| 98 | |||
| 99 | 12 | $this->readNextLine(); |
|
| 100 | 12 | return $sr; |
|
| 101 | } |
||
| 102 | |||
| 103 | if ($this->handle) { |
||
| 104 | fclose($this->handle); |
||
| 105 | } |
||
| 106 | return null; |
||
| 107 | } |
||
| 108 | |||
| 114 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.