public function NormalizerBase::supportsNormalization in Drupal 9
Same name and namespace in other branches
- 8 core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::supportsNormalization()
- 10 core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::supportsNormalization()
1 method overrides NormalizerBase::supportsNormalization()
- EntityDenormalizerBase::supportsNormalization in core/
modules/ jsonapi/ src/ Normalizer/ EntityDenormalizerBase.php
File
- core/
modules/ serialization/ src/ Normalizer/ NormalizerBase.php, line 33
Class
- NormalizerBase
- Base class for Normalizers.
Namespace
Drupal\serialization\NormalizerCode
public function supportsNormalization($data, $format = NULL) {
// If we aren't dealing with an object or the format is not supported return
// now.
if (!is_object($data) || !$this
->checkFormat($format)) {
return FALSE;
}
$supported = (array) $this->supportedInterfaceOrClass;
return (bool) array_filter($supported, function ($name) use ($data) {
return $data instanceof $name;
});
}