| Total Complexity | 5 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class EdifactParser |
||
| 14 | { |
||
| 15 | private SegmentFactoryInterface $segmentFactory; |
||
| 16 | |||
| 17 | 4 | public static function create(?SegmentFactoryInterface $segmentFactory = null): self |
|
| 18 | { |
||
| 19 | 4 | return new self($segmentFactory ?? new SegmentFactory()); |
|
| 20 | } |
||
| 21 | |||
| 22 | 4 | private function __construct(SegmentFactoryInterface $segmentFactory) |
|
| 23 | { |
||
| 24 | 4 | $this->segmentFactory = $segmentFactory; |
|
| 25 | 4 | } |
|
| 26 | |||
| 27 | 1 | public function __invoke(string $fileContent): TransactionResult |
|
| 28 | { |
||
| 29 | 1 | return $this->parse($fileContent); |
|
| 30 | } |
||
| 31 | |||
| 32 | 4 | public function parse(string $fileContent): TransactionResult |
|
| 44 | } |
||
| 45 | } |
||
| 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.