| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 4 | public function parse(string $fileContent): array |
|
| 34 | { |
||
| 35 | 4 | $parser = new Parser($fileContent); |
|
| 36 | 4 | $errors = $parser->errors(); |
|
| 37 | |||
| 38 | 4 | if ($errors) { |
|
|
|
|||
| 39 | 1 | throw InvalidFile::withErrors($errors); |
|
| 40 | } |
||
| 41 | |||
| 42 | 3 | $segmentList = SegmentList::factory($this->segmentFactory); |
|
| 43 | 3 | $segments = $segmentList->fromRaw($parser->get()); |
|
| 44 | |||
| 45 | 3 | return TransactionMessage::groupSegmentsByMessage(...$segments); |
|
| 46 | } |
||
| 48 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.