| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 4 | public function parse(string $fileContent): TransactionResult |
|
| 22 | { |
||
| 23 | 4 | $parser = new Parser($fileContent); |
|
| 24 | 4 | $errors = $parser->errors(); |
|
| 25 | |||
| 26 | 4 | if ($errors) { |
|
|
|
|||
| 27 | 1 | throw InvalidFile::withErrors($errors); |
|
| 28 | } |
||
| 29 | |||
| 30 | 3 | $segmentedValues = SegmentedValues::fromRaw($parser->get(), $this->customSegmentsFactory); |
|
| 31 | |||
| 32 | 3 | return TransactionResult::fromSegmentedValues($segmentedValues); |
|
| 33 | } |
||
| 35 |
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.