You are here

class NormalizerWrapper in Acquia Content Hub 8

Wrapper for the normalizer.

@package Drupal\acquia_contenthub\Normalizer

Hierarchy

  • class \Drupal\serialization\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\SerializerAwareInterface, CacheableNormalizerInterface uses \Symfony\Component\Serializer\SerializerAwareTrait
    • class \Drupal\acquia_contenthub\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface

Expanded class hierarchy of NormalizerWrapper

1 string reference to 'NormalizerWrapper'
acquia_contenthub.services.yml in ./acquia_contenthub.services.yml
acquia_contenthub.services.yml
1 service uses NormalizerWrapper
serializer.normalizer.acquia_contenthub_cdf.acquia_contenthub in ./acquia_contenthub.services.yml
Drupal\acquia_contenthub\Normalizer\NormalizerWrapper

File

src/Normalizer/NormalizerWrapper.php, line 10

Namespace

Drupal\acquia_contenthub\Normalizer
View source
class NormalizerWrapper extends NormalizerBase {

  /**
   * Normalizer for content entity cdfs.
   *
   * @var \Drupal\acquia_contenthub\Normalizer\ContentEntityCdfNormalizer
   */
  protected $contentEntityCdfNormalizer;

  /**
   * NormalizerWrapper constructor.
   *
   * @param \Drupal\acquia_contenthub\Normalizer\ContentEntityCdfNormalizer $contentEntityCdfNormalizer
   *   CDF Normalizer.
   */
  public function __construct(ContentEntityCdfNormalizer $contentEntityCdfNormalizer) {
    $this->contentEntityCdfNormalizer = $contentEntityCdfNormalizer;
  }

  /**
   * Call for content entity cdf normalizer.
   *
   * @param mixed $name
   *   Name for the cdf normalizer.
   * @param mixed $arguments
   *   Arguments for the cdf normalizer.
   *
   * @return mixed
   *   Returns the normalized name for the entity.
   */
  public function __call($name, $arguments) {
    return $this->contentEntityCdfNormalizer
      ->{$name}(...$arguments);
  }

  /**
   * Checks normalization support.
   *
   * @param mixed $data
   *   Data for the normalization.
   * @param mixed|null $format
   *   Format for the normalization.
   *
   * @return mixed
   *   Whether this supports normalization.
   */
  public function supportsNormalization($data, $format = NULL) {
    return $this->contentEntityCdfNormalizer
      ->supportsNormalization($data, $format);
  }

  /**
   * Checks for denormalization support.
   *
   * @param mixed $data
   *   Data for denormalization.
   * @param mixed $type
   *   Type for denormalization.
   * @param mixed|null $format
   *   Format for denormalization.
   *
   * @return mixed
   *   Whether this supports denormalization.
   */
  public function supportsDenormalization($data, $type, $format = NULL) {
    return $this->contentEntityCdfNormalizer
      ->supportsDenormalization($data, $type, $format);
  }

  /**
   * Denormalizes entities.
   *
   * @param mixed $data
   *   Data for denormalization.
   * @param mixed $class
   *   Class to denormalize.
   * @param mixed|null $format
   *   Format for denormalization.
   * @param array $context
   *   Context for denormalization.
   *
   * @return array|\Drupal\Core\Entity\ContentEntityInterface|null
   *   Content Hub Entity denormalized.
   */
  public function denormalize($data, $class, $format = NULL, array $context = []) {
    return $this->contentEntityCdfNormalizer
      ->denormalize($data, $class, $format, $context);
  }

  /**
   * Normalizes entities.
   *
   * @param mixed $object
   *   Object to normalize.
   * @param mixed|null $format
   *   Format to normalize.
   * @param array $context
   *   Context for normalization.
   *
   * @return \Acquia\ContentHubClient\Entity[][]|array|bool|float|int|string|null
   *   Content Hub Entity normalized.
   */
  public function normalize($object, $format = NULL, array $context = []) {
    return $this->contentEntityCdfNormalizer
      ->normalize($object, $format, $context);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY constant Name of key for bubbling cacheability metadata via serialization context.
NormalizerBase::$format protected property List of formats which supports (de-)normalization. 3
NormalizerBase::$supportedInterfaceOrClass protected property The interface or class that this Normalizer supports. 22
NormalizerBase::addCacheableDependency protected function Adds cacheability if applicable.
NormalizerBase::checkFormat protected function Checks if the provided format is supported by this normalizer. 2
NormalizerWrapper::$contentEntityCdfNormalizer protected property Normalizer for content entity cdfs.
NormalizerWrapper::denormalize public function Denormalizes entities.
NormalizerWrapper::normalize public function Normalizes entities.
NormalizerWrapper::supportsDenormalization public function Checks for denormalization support. Overrides NormalizerBase::supportsDenormalization
NormalizerWrapper::supportsNormalization public function Checks normalization support. Overrides NormalizerBase::supportsNormalization
NormalizerWrapper::__call public function Call for content entity cdf normalizer.
NormalizerWrapper::__construct public function NormalizerWrapper constructor.