public function SerializationTestNormalizer::normalize

Normalizes an object into a set of arrays/scalars.

Parameters

object $object: Object to normalize.

string $format: Format the normalization result will be encoded as.

Return value

array An array containing a normalized representation of $object, appropriate for encoding to the requested format.

Overrides NormalizerInterface::normalize

File

drupal/core/modules/system/tests/modules/serialization_test/lib/Drupal/serialization_test/SerializationTestNormalizer.php, line 33
Definition of Drupal\serialization_test\SerializationTestNormalizer.

Class

SerializationTestNormalizer

Namespace

Drupal\serialization_test

Code

public function normalize($object, $format = NULL) {
  $normalized = (array) $object;

  // Add identifying value that can be used to verify that the expected
  // normalizer was invoked.
  $normalized['normalized_by'] = 'SerializationTestNormalizer';
  return $normalized;
}