public function NormalizerBase::supportsDenormalization in Zircon Profile 8.0
Same name in this branch
- 8.0 core/modules/hal/src/Normalizer/NormalizerBase.php \Drupal\hal\Normalizer\NormalizerBase::supportsDenormalization()
- 8.0 core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::supportsDenormalization()
Same name and namespace in other branches
- 8 core/modules/hal/src/Normalizer/NormalizerBase.php \Drupal\hal\Normalizer\NormalizerBase::supportsDenormalization()
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
This class doesn't implement DenormalizerInterface, but most of its child classes do, so this method is implemented at this level to reduce code duplication.
Overrides NormalizerBase::supportsDenormalization
File
- core/
modules/ hal/ src/ Normalizer/ NormalizerBase.php, line 35 - Contains \Drupal\hal\Normalizer\NormalizerBase.
Class
- NormalizerBase
- Base class for Normalizers.
Namespace
Drupal\hal\NormalizerCode
public function supportsDenormalization($data, $type, $format = NULL) {
if (in_array($format, $this->formats) && (class_exists($this->supportedInterfaceOrClass) || interface_exists($this->supportedInterfaceOrClass))) {
$target = new \ReflectionClass($type);
$supported = new \ReflectionClass($this->supportedInterfaceOrClass);
if ($supported
->isInterface()) {
return $target
->implementsInterface($this->supportedInterfaceOrClass);
}
else {
return $target
->getName() == $this->supportedInterfaceOrClass || $target
->isSubclassOf($this->supportedInterfaceOrClass);
}
}
return FALSE;
}