JsonApiNormalizerDecoratorBase.php in JSON:API Extras 8.3
File
src/Normalizer/JsonApiNormalizerDecoratorBase.php
View source
<?php
namespace Drupal\jsonapi_extras\Normalizer;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\SerializerAwareInterface;
use Symfony\Component\Serializer\SerializerInterface;
class JsonApiNormalizerDecoratorBase implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface {
protected $inner;
public function __construct($inner) {
assert($inner instanceof NormalizerInterface || $inner instanceof DenormalizerInterface);
assert($inner instanceof SerializerAwareInterface);
$this->inner = $inner;
}
public function normalize($object, $format = NULL, array $context = []) {
return $this->inner
->normalize($object, $format, $context);
}
public function denormalize($data, $class, $format = NULL, array $context = []) {
return $this->inner
->denormalize($data, $class, $format, $context);
}
public function setSerializer(SerializerInterface $serializer) {
$this->inner
->setSerializer($serializer);
}
public function supportsNormalization($data, $format = NULL) {
return $this->inner instanceof NormalizerInterface && $this->inner
->supportsNormalization($data, $format);
}
public function supportsDenormalization($data, $type, $format = NULL) {
return $this->inner instanceof DenormalizerInterface && $this->inner
->supportsDenormalization($data, $type, $format);
}
}