| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | 4 | public function parse(string $fileContent): TransactionResult |
|
| 33 | { |
||
| 34 | 4 | $parser = new Parser($fileContent); |
|
| 35 | 4 | $errors = $parser->errors(); |
|
| 36 | |||
| 37 | 4 | if ($errors) { |
|
|
|
|||
| 38 | 1 | throw InvalidFile::withErrors($errors); |
|
| 39 | } |
||
| 40 | |||
| 41 | 3 | $segmentedValues = SegmentedValues::factory($this->segmentFactory)->fromRaw($parser->get()); |
|
| 42 | |||
| 43 | 3 | return TransactionResult::fromSegmentedValues($segmentedValues); |
|
| 44 | } |
||
| 46 |
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.