| Conditions | 9 |
| Paths | 9 |
| Total Lines | 24 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 10.2655 |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | /** @var CustomSegmentFactoryInterface|null */ |
||
| 10 | private $customSegmentsFactory; |
||
| 11 | |||
| 12 | 7 | public function __construct(?CustomSegmentFactoryInterface $customSegmentsFactory) |
|
| 13 | { |
||
| 14 | 7 | $this->customSegmentsFactory = $customSegmentsFactory; |
|
| 15 | 7 | } |
|
| 16 | |||
| 17 | 7 | public function segmentFromArray(array $rawArray): SegmentInterface |
|
| 18 | { |
||
| 19 | 7 | $customSegment = $this->customSegment($rawArray); |
|
| 20 | |||
| 21 | 7 | if ($customSegment) { |
|
| 22 | 1 | return $customSegment; |
|
| 23 | } |
||
| 24 | |||
| 25 | 7 | $name = $rawArray[0]; |
|
| 26 | |||
| 27 | 7 | switch ($name) { |
|
| 28 | 7 | case 'UNH': |
|
| 29 | 7 | return new UNHMessageHeader($rawArray); |
|
| 30 | 6 | case 'DTM': |
|
| 31 | return new DTMDateTimePeriod($rawArray); |
||
| 32 | 6 | case 'NAD': |
|
| 33 | return new NADNameAddress($rawArray); |
||
| 61 |