Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ChainEncoder.php

function ChainEncoder::needsNormalization

Checks whether the normalization is needed for the given format.

File

vendor/symfony/serializer/Encoder/ChainEncoder.php, line 60

Class

ChainEncoder
Encoder delegating the decoding to a chain of encoders.

Namespace

Symfony\Component\Serializer\Encoder

Code

public function needsNormalization(string $format, array $context = []) : bool {
    $encoder = $this->getEncoder($format, $context);
    if ($encoder instanceof TraceableEncoder) {
        return $encoder->needsNormalization();
    }
    if (!$encoder instanceof NormalizationAwareInterface) {
        return true;
    }
    if ($encoder instanceof self) {
        return $encoder->needsNormalization($format, $context);
    }
    return false;
}
RSS feed
Powered by Drupal