Total Complexity | 5 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class TestingSegmentFactory implements SegmentFactoryInterface |
||
13 | { |
||
14 | private string $customKey; |
||
15 | |||
16 | private SegmentFactory $defaultFactory; |
||
17 | |||
18 | public function __construct(string $customKey) |
||
22 | } |
||
23 | |||
24 | public function createSegmentFromArray(array $rawArray): SegmentInterface |
||
25 | { |
||
26 | if ($this->customKey !== $rawArray[0]) { |
||
27 | return $this->defaultFactory->createSegmentFromArray($rawArray); |
||
28 | } |
||
29 | |||
30 | return new /** @psalm-immutable */ class($rawArray) implements SegmentInterface { |
||
31 | private array $rawArray; |
||
32 | |||
33 | public function __construct(array $rawArray) |
||
36 | } |
||
37 | |||
38 | public function tag(): string |
||
39 | { |
||
40 | return (string) $this->rawArray[0]; |
||
41 | } |
||
42 | |||
43 | public function subId(): string |
||
44 | { |
||
45 | return (string) $this->rawArray[1]; |
||
46 | } |
||
47 | |||
48 | public function rawValues(): array |
||
51 | } |
||
52 | }; |
||
53 | } |
||
54 | } |
||
55 |