| 1 | <?php |
||
| 9 | final class Decoder implements DecoderInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var TypeDecoderInterface[] |
||
| 13 | */ |
||
| 14 | private $decoderTypes; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param TypeDecoderInterface[] $decoderTypes |
||
| 18 | */ |
||
| 19 | 3 | public function __construct(array $decoderTypes) |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @param TypeDecoderInterface $decoderType |
||
| 29 | */ |
||
| 30 | 3 | private function addTypeDecoder(TypeDecoderInterface $decoderType) |
|
| 31 | { |
||
| 32 | 3 | $this->decoderTypes[$decoderType->getContentType()] = $decoderType; |
|
| 33 | 3 | } |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @return array |
||
| 37 | */ |
||
| 38 | 1 | public function getContentTypes(): array |
|
| 42 | |||
| 43 | /** |
||
| 44 | * @param string $data |
||
| 45 | * @param string $contentType |
||
| 46 | * |
||
| 47 | * @return array |
||
| 48 | * |
||
| 49 | * @throws DeserializerLogicException |
||
| 50 | */ |
||
| 51 | 2 | public function decode(string $data, string $contentType): array |
|
| 59 | } |
||
| 60 |