public function SerializationTestNormalizer::normalize in Drupal 9
Same name and namespace in other branches
- 8 core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php \Drupal\serialization_test\SerializationTestNormalizer::normalize()
Normalizes an object into a set of arrays/scalars.
Parameters
object $object: Object to normalize.
string|null $format: (optional) Format the normalization result will be encoded as. Defaults to NULL
array $context: (optional) The context data. Defaults to an empty array.
Return value
array An array containing a normalized representation of $object, appropriate for encoding to the requested format.
File
- core/
modules/ serialization/ tests/ serialization_test/ src/ SerializationTestNormalizer.php, line 31
Class
Namespace
Drupal\serialization_testCode
public function normalize($object, $format = NULL, array $context = []) {
$normalized = (array) $object;
// Add identifying value that can be used to verify that the expected
// normalizer was invoked.
$normalized['normalized_by'] = 'SerializationTestNormalizer';
return $normalized;
}