| Total Complexity | 8 | 
| Total Lines | 41 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 7 | final class SerializerRegistry implements SerializerInterface, SerializerRegistryInterface | ||
| 8 | { | ||
| 9 | /** @var array<non-empty-string, SerializerInterface> */ | ||
|  | |||
| 10 | private array $serializers = []; | ||
| 11 | private SerializerInterface $default; | ||
| 12 | |||
| 13 | /** @param array<non-empty-string, SerializerInterface> $serializers */ | ||
| 14 | 212 | public function __construct(SerializerInterface $default) | |
| 15 |     { | ||
| 16 | 212 | $this->default = $default; | |
| 17 | } | ||
| 18 | |||
| 19 | 1 | public function serialize(array $payload): string | |
| 20 |     { | ||
| 21 | 1 | return $this->default->serialize($payload); | |
| 22 | } | ||
| 23 | |||
| 24 | 1 | public function deserialize(string $payload): array | |
| 27 | } | ||
| 28 | |||
| 29 | 2 | public function getSerializer(string $jobType): SerializerInterface | |
| 30 |     { | ||
| 31 | 2 |         if (!$this->hasSerializer($jobType)) { | |
| 32 | 2 | return $this->default; | |
| 33 | } | ||
| 34 | |||
| 35 | 2 | return $this->serializers[$jobType]; | |
| 36 | } | ||
| 37 | |||
| 38 | 3 | public function addSerializer(string $jobType, SerializerInterface $serializer): void | |
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | 3 | public function hasSerializer(string $jobType): bool | |
| 50 |