private function getDenormalizer($data, string $class, ?string $format, array $context)
    {
        if ($this->cachedNormalizers !== $this->normalizers) {
            $this->cachedNormalizers = $this->normalizers;
            $this->denormalizerCache = $this->normalizerCache = [];
        }
        if (!isset($this->denormalizerCache[$format][$class])) {
            $this->denormalizerCache[$format][$class] = [];

            foreach ($this->normalizers as $k => $normalizer) {
                if (!$normalizer instanceof DenormalizerInterface) {
                    continue;
                }

                if (!$normalizer instanceof CacheableSupportsMethodInterface || !$normalizer->hasCacheableSupportsMethod()) {
                    $this->denormalizerCache[$format][$class][$k] = false;
                } elseif ($normalizer->supportsDenormalization(null, $class, $format, $context)) {
                    $this->denormalizerCache[$format][$class][$k] = true;
                    break;
                }
            }
        }

        foreach ($this->denormalizerCache[$format][$class] as $k => $cached) {
            $normalizer = $this->normalizers[$k];
            if ($cached || $normalizer->supportsDenormalization($data, $class, $format, $context)) {
                return $normalizer;
            }
        }
    }
private function getDenormalizer($data, string $class, ?string $format, array $context)
    {
        if ($this->cachedNormalizers !== $this->normalizers) {
            $this->cachedNormalizers = $this->normalizers;
            $this->denormalizerCache = $this->normalizerCache = [];
        }
        if (!isset($this->denormalizerCache[$format][$class])) {
            $this->denormalizerCache[$format][$class] = [];

            foreach ($this->normalizers as $k => $normalizer) {
                if (!$normalizer instanceof DenormalizerInterface) {
                    continue;
                }

                if (!$normalizer instanceof CacheableSupportsMethodInterface || !$normalizer->hasCacheableSupportsMethod()) {
                    $this->denormalizerCache[$format][$class][$k] = false;
                } elseif ($normalizer->supportsDenormalization(null, $class, $format, $context)) {
                    $this->denormalizerCache[$format][$class][$k] = true;
                    break;
                }
            }
        }

        foreach ($this->denormalizerCache[$format][$class] as $k => $cached) {
            $normalizer = $this->normalizers[$k];
            if ($cached || $normalizer->supportsDenormalization($data, $class, $format, $context)) {
                return $normalizer;
            }
        }
    }
private function getDenormalizer ( $ data , string $ class , ? string $ format , array $ context ) { if ( $ this -> cachedNormalizers !== $ this -> normalizers ) { $ this -> cachedNormalizers = $ this -> normalizers ; $ this -> denormalizerCache = $ this -> normalizerCache = [ ] ; } if ( ! isset ( $ this -> denormalizerCache [ $ format ] [ $ class ] ) ) { $ this -> denormalizerCache [ $ format ] [ $ class ] = [ ] ; foreach ( $ this -> normalizers as $ k => $ normalizer ) { if ( ! $ normalizer instanceof DenormalizerInterface ) { continue ; } if ( ! $ normalizer instanceof CacheableSupportsMethodInterface || ! $ normalizer -> hasCacheableSupportsMethod ( ) ) { $ this -> denormalizerCache [ $ format ] [ $ class ] [ $ k ] = false ; } elseif ( $ normalizer -> supportsDenormalization ( null , $ class , $ format , $ context ) ) { $ this -> denormalizerCache [ $ format ] [ $ class ] [ $ k ] = true ; break ; } } } foreach ( $ this -> denormalizerCache [ $ format ] [ $ class ] as $ k => $ cached ) { $ normalizer = $ this -> normalizers [ $ k ] ; if ( $ cached || $ normalizer -> supportsDenormalization ( $ data , $ class , $ format , $ context ) ) { return $ normalizer ; } } }
Returns a matching denormalizer.

@param mixed  $data    Data to restore
@param string $class   The expected class to instantiate
@param string $format  Format name, present to give the option to normalizers to act differently based on formats
@param array  $context Options available to the denormalizer

@return DenormalizerInterface|null
Returns a matching denormalizer .