| Total Complexity | 7 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class BinnEncoder implements EncoderInterface, DecoderInterface |
||
| 11 | { |
||
| 12 | public const FORMAT = 'binn'; |
||
| 13 | |||
| 14 | protected $encodingImpl; |
||
| 15 | protected $decodingImpl; |
||
| 16 | |||
| 17 | public function __construct(BinnEncode $encodingImpl = null, BinnDecode $decodingImpl = null) |
||
| 18 | { |
||
| 19 | $this->encodingImpl = $encodingImpl ?: new BinnEncode( |
||
| 20 | (new EncoderCollectionFactory())->getCollection() |
||
| 21 | ); |
||
| 22 | |||
| 23 | $this->decodingImpl = $decodingImpl ?: new BinnDecode( |
||
| 24 | (new DecoderCollectionFactory())->getCollection() |
||
| 25 | ); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function decode(string $data, string $format, array $context = []) |
||
| 29 | { |
||
| 30 | return $this->decodingImpl->decode($data, $format, $context); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function encode($data, string $format, array $context = []) |
||
| 34 | { |
||
| 35 | return $this->encodingImpl->encode($data, $format, $context); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * {@inheritdoc} |
||
| 40 | */ |
||
| 41 | public function supportsEncoding(string $format) |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * {@inheritdoc} |
||
| 48 | */ |
||
| 49 | public function supportsDecoding(string $format) |
||
| 52 | } |
||
| 53 | } |
||
| 54 |