public function __construct( private array
$normalizers =
[],
array
$encoders =
[],
) { foreach ($normalizers as $normalizer) { if ($normalizer instanceof SerializerAwareInterface
) { $normalizer->
setSerializer($this);
} if ($normalizer instanceof DenormalizerAwareInterface
) { $normalizer->
setDenormalizer($this);
} if ($normalizer instanceof NormalizerAwareInterface
) { $normalizer->
setNormalizer($this);
} if (!
($normalizer instanceof NormalizerInterface ||
$normalizer instanceof DenormalizerInterface
)) { throw new InvalidArgumentException(sprintf('The class "%s" neither implements "%s" nor "%s".',
get_debug_type($normalizer), NormalizerInterface::
class, DenormalizerInterface::
class));
} }