You are here

private function Serializer::normalizeObject in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Serializer.php \Symfony\Component\Serializer\Serializer::normalizeObject()

Normalizes an object into a set of arrays/scalars.

Parameters

object $object object to normalize:

string $format format name, present to give the option to normalizers to act differently based on formats:

array $context The context data for this particular normalization:

Return value

array|string|bool|int|float|null

Throws

LogicException

UnexpectedValueException

1 call to Serializer::normalizeObject()
Serializer::normalize in vendor/symfony/serializer/Serializer.php
Normalizes an object into a set of arrays/scalars.

File

vendor/symfony/serializer/Serializer.php, line 258

Class

Serializer
Serializer serializes and deserializes data.

Namespace

Symfony\Component\Serializer

Code

private function normalizeObject($object, $format, array $context = array()) {
  if (!$this->normalizers) {
    throw new LogicException('You must register at least one normalizer to be able to normalize objects.');
  }
  if ($normalizer = $this
    ->getNormalizer($object, $format)) {
    return $normalizer
      ->normalize($object, $format, $context);
  }
  throw new UnexpectedValueException(sprintf('Could not normalize object of type %s, no supporting normalizer found.', get_class($object)));
}