Chris@18: fallbackNormalizer = $normalizer; Chris@18: } Chris@18: Chris@18: /** Chris@18: * {@inheritdoc} Chris@18: */ Chris@18: public function normalize($data, $format = NULL, array $context = []) { Chris@18: if ($this->selfSupportsNormalization($data, $format, $context)) { Chris@18: return parent::normalize($data, $format, $context); Chris@18: } Chris@18: if ($this->fallbackNormalizer->supportsNormalization($data, $format, $context)) { Chris@18: return $this->fallbackNormalizer->normalize($data, $format, $context); Chris@18: } Chris@18: return parent::normalize($data, $format, $context); Chris@18: } Chris@18: Chris@18: /** Chris@18: * {@inheritdoc} Chris@18: */ Chris@18: public function denormalize($data, $type, $format = NULL, array $context = []) { Chris@18: if ($this->selfSupportsDenormalization($data, $type, $format, $context)) { Chris@18: return parent::denormalize($data, $type, $format, $context); Chris@18: } Chris@18: return $this->fallbackNormalizer->denormalize($data, $type, $format, $context); Chris@18: } Chris@18: Chris@18: /** Chris@18: * {@inheritdoc} Chris@18: */ Chris@18: public function supportsNormalization($data, $format = NULL, array $context = []) { Chris@18: return $this->selfSupportsNormalization($data, $format, $context) || $this->fallbackNormalizer->supportsNormalization($data, $format, $context); Chris@18: } Chris@18: Chris@18: /** Chris@18: * Checks whether this class alone supports normalization. Chris@18: * Chris@18: * @param mixed $data Chris@18: * Data to normalize. Chris@18: * @param string $format Chris@18: * The format being (de-)serialized from or into. Chris@18: * @param array $context Chris@18: * (optional) Options available to the normalizer. Chris@18: * Chris@18: * @return bool Chris@18: * Whether this class supports normalization for the given data. Chris@18: */ Chris@18: private function selfSupportsNormalization($data, $format = NULL, array $context = []) { Chris@18: return parent::supportsNormalization($data, $format, $context); Chris@18: } Chris@18: Chris@18: /** Chris@18: * {@inheritdoc} Chris@18: */ Chris@18: public function supportsDenormalization($data, $type, $format = NULL, array $context = []) { Chris@18: return $this->selfSupportsDenormalization($data, $type, $format, $context) || $this->fallbackNormalizer->supportsDenormalization($data, $type, $format, $context); Chris@18: } Chris@18: Chris@18: /** Chris@18: * Checks whether this class alone supports denormalization. Chris@18: * Chris@18: * @param mixed $data Chris@18: * Data to denormalize from. Chris@18: * @param string $type Chris@18: * The class to which the data should be denormalized. Chris@18: * @param string $format Chris@18: * The format being deserialized from. Chris@18: * @param array $context Chris@18: * (optional) Options available to the denormalizer. Chris@18: * Chris@18: * @return bool Chris@18: * Whether this class supports normalization for the given data and type. Chris@18: */ Chris@18: private function selfSupportsDenormalization($data, $type, $format = NULL, array $context = []) { Chris@18: return parent::supportsDenormalization($data, $type, $format, $context); Chris@18: } Chris@18: Chris@18: }