| Total Complexity | 5 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | final class TestingSegmentFactory implements SegmentFactoryInterface |
||
| 12 | { |
||
| 13 | private string $customKey; |
||
| 14 | |||
| 15 | private SegmentFactory $defaultFactory; |
||
| 16 | |||
| 17 | public function __construct(string $customKey) |
||
| 21 | } |
||
| 22 | |||
| 23 | public function segmentFromArray(array $rawArray): SegmentInterface |
||
| 24 | { |
||
| 25 | if ($this->customKey !== $rawArray[0]) { |
||
| 26 | return $this->defaultFactory->segmentFromArray($rawArray); |
||
| 27 | } |
||
| 28 | |||
| 29 | return new class($rawArray) implements SegmentInterface { |
||
| 30 | private array $rawArray; |
||
| 31 | |||
| 32 | public function __construct(array $rawArray) |
||
| 33 | { |
||
| 34 | $this->rawArray = $rawArray; |
||
| 35 | } |
||
| 36 | |||
| 37 | public function name(): string |
||
| 40 | } |
||
| 41 | |||
| 42 | public function subSegmentKey(): string |
||
| 45 | } |
||
| 46 | |||
| 47 | public function rawValues(): array |
||
| 50 | } |
||
| 51 | }; |
||
| 52 | } |
||
| 54 |