class StringNormalizer
Normalizes string data weirdly: replaces 'super' with 'NOT' and vice versa.
Hierarchy
- class \Drupal\serialization\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\SerializerAwareInterface, \Drupal\serialization\Normalizer\CacheableNormalizerInterface, \Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface uses \Symfony\Component\Serializer\SerializerAwareTrait
- class \Drupal\jsonapi_test_data_type\Normalizer\StringNormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface extends \Drupal\serialization\Normalizer\NormalizerBase
Expanded class hierarchy of StringNormalizer
1 string reference to 'StringNormalizer'
- jsonapi_test_data_type.services.yml in core/
modules/ jsonapi/ tests/ modules/ jsonapi_test_data_type/ jsonapi_test_data_type.services.yml - core/modules/jsonapi/tests/modules/jsonapi_test_data_type/jsonapi_test_data_type.services.yml
1 service uses StringNormalizer
- serializer.normalizer.string.jsonapi_test_data_type in core/
modules/ jsonapi/ tests/ modules/ jsonapi_test_data_type/ jsonapi_test_data_type.services.yml - Drupal\jsonapi_test_data_type\Normalizer\StringNormalizer
File
-
core/
modules/ jsonapi/ tests/ modules/ jsonapi_test_data_type/ src/ Normalizer/ StringNormalizer.php, line 12
Namespace
Drupal\jsonapi_test_data_type\NormalizerView source
class StringNormalizer extends NormalizerBase implements DenormalizerInterface {
/**
* {@inheritdoc}
*/
protected $supportedInterfaceOrClass = StringData::class;
/**
* {@inheritdoc}
*/
public function normalize($object, $format = NULL, array $context = []) {
return str_replace('super', 'NOT', $object->getValue());
}
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = NULL, array $context = []) {
return str_replace('NOT', 'super', $data);
}
/**
* {@inheritdoc}
*/
public function hasCacheableSupportsMethod() : bool {
return TRUE;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
|---|---|---|---|---|---|
| CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY | constant | Name of key for bubbling cacheability metadata via serialization context. | |||
| NormalizerBase::$format | protected | property | List of formats which supports (de-)normalization. | 3 | |
| NormalizerBase::addCacheableDependency | protected | function | Adds cacheability if applicable. | ||
| NormalizerBase::checkFormat | protected | function | Checks if the provided format is supported by this normalizer. | 1 | |
| NormalizerBase::supportsDenormalization | public | function | Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() | 1 | |
| NormalizerBase::supportsNormalization | public | function | 1 | ||
| StringNormalizer::$supportedInterfaceOrClass | protected | property | The interface or class that this Normalizer supports. | Overrides NormalizerBase::$supportedInterfaceOrClass | |
| StringNormalizer::denormalize | public | function | |||
| StringNormalizer::hasCacheableSupportsMethod | public | function | Overrides NormalizerBase::hasCacheableSupportsMethod | ||
| StringNormalizer::normalize | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.