class JsonApiNormalizerDecoratorBase in JSON:API Extras 8.3
Base class for decorated normalizers.
Hierarchy
- class \Drupal\jsonapi_extras\Normalizer\JsonApiNormalizerDecoratorBase implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface, \Symfony\Component\Serializer\SerializerAwareInterface, \Symfony\Component\Serializer\Normalizer\NormalizerInterface
Expanded class hierarchy of JsonApiNormalizerDecoratorBase
File
- src/
Normalizer/ JsonApiNormalizerDecoratorBase.php, line 13
Namespace
Drupal\jsonapi_extras\NormalizerView source
class JsonApiNormalizerDecoratorBase implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface {
/**
* The decorated (de)normalizer.
*
* @var \Symfony\Component\Serializer\SerializerAwareInterface|\Symfony\Component\Serializer\Normalizer\NormalizerInterface|\Symfony\Component\Serializer\Normalizer\DenormalizerInterface
*/
protected $inner;
/**
* JsonApiNormalizerDecoratorBase constructor.
*
* @param \Symfony\Component\Serializer\SerializerAwareInterface|\Symfony\Component\Serializer\Normalizer\NormalizerInterface|\Symfony\Component\Serializer\Normalizer\DenormalizerInterface $inner
* The decorated normalizer or denormalizer.
*/
public function __construct($inner) {
assert($inner instanceof NormalizerInterface || $inner instanceof DenormalizerInterface);
assert($inner instanceof SerializerAwareInterface);
$this->inner = $inner;
}
/**
* {@inheritdoc}
*/
public function normalize($object, $format = NULL, array $context = []) {
return $this->inner
->normalize($object, $format, $context);
}
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = NULL, array $context = []) {
return $this->inner
->denormalize($data, $class, $format, $context);
}
/**
* {@inheritdoc}
*/
public function setSerializer(SerializerInterface $serializer) {
$this->inner
->setSerializer($serializer);
}
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = NULL) {
return $this->inner instanceof NormalizerInterface && $this->inner
->supportsNormalization($data, $format);
}
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = NULL) {
return $this->inner instanceof DenormalizerInterface && $this->inner
->supportsDenormalization($data, $type, $format);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JsonApiNormalizerDecoratorBase:: |
protected | property | The decorated (de)normalizer. | |
JsonApiNormalizerDecoratorBase:: |
public | function | Denormalizes data back into an object of the given class. | 2 |
JsonApiNormalizerDecoratorBase:: |
public | function | Normalizes an object into a set of arrays/scalars. | 3 |
JsonApiNormalizerDecoratorBase:: |
public | function | Sets the owning Serializer object. | |
JsonApiNormalizerDecoratorBase:: |
public | function | Checks whether the given class is supported for denormalization by this normalizer. | |
JsonApiNormalizerDecoratorBase:: |
public | function | Checks whether the given class is supported for normalization by this normalizer. | |
JsonApiNormalizerDecoratorBase:: |
public | function | JsonApiNormalizerDecoratorBase constructor. | 2 |