function NormalizerBase::supportsDenormalization
Same name in other branches
- 9 core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::supportsDenormalization()
- 8.9.x core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::supportsDenormalization()
- 10 core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::supportsDenormalization()
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
This class doesn't implement DenormalizerInterface, but most of its child classes do. Therefore, this method is implemented at this level to reduce code duplication.
1 method overrides NormalizerBase::supportsDenormalization()
- ResourceObjectNormalizer::supportsDenormalization in core/
modules/ jsonapi/ src/ Normalizer/ ResourceObjectNormalizer.php - Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
File
-
core/
modules/ serialization/ src/ Normalizer/ NormalizerBase.php, line 46
Class
- NormalizerBase
- Base class for Normalizers.
Namespace
Drupal\serialization\NormalizerCode
public function supportsDenormalization($data, string $type, ?string $format = NULL, array $context = []) : bool {
// If the format is not supported return now.
if (!$this->checkFormat($format)) {
return FALSE;
}
$supported = array_keys($this->getSupportedTypes($format));
$subclass_check = function ($name) use ($type) {
return (class_exists($name) || interface_exists($name)) && is_subclass_of($type, $name, TRUE);
};
return in_array($type, $supported) || array_filter($supported, $subclass_check);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.