private function Serializer::getNormalizer in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/serializer/Serializer.php \Symfony\Component\Serializer\Serializer::getNormalizer()
Returns a matching normalizer.
Parameters
mixed $data Data to get the serializer for:
string $format format name, present to give the option to normalizers to act differently based on formats:
Return value
NormalizerInterface|null
3 calls to Serializer::getNormalizer()
- Serializer::normalize in vendor/
symfony/ serializer/ Serializer.php - Normalizes an object into a set of arrays/scalars.
- Serializer::normalizeObject in vendor/
symfony/ serializer/ Serializer.php - Normalizes an object into a set of arrays/scalars.
- Serializer::supportsNormalization in vendor/
symfony/ serializer/ Serializer.php - Checks whether the given class is supported for normalization by this normalizer.
File
- vendor/
symfony/ serializer/ Serializer.php, line 186
Class
- Serializer
- Serializer serializes and deserializes data.
Namespace
Symfony\Component\SerializerCode
private function getNormalizer($data, $format) {
if ($isObject = is_object($data)) {
$class = get_class($data);
if (isset($this->normalizerCache[$class][$format])) {
return $this->normalizerCache[$class][$format];
}
}
foreach ($this->normalizers as $normalizer) {
if ($normalizer instanceof NormalizerInterface && $normalizer
->supportsNormalization($data, $format)) {
if ($isObject) {
$this->normalizerCache[$class][$format] = $normalizer;
}
return $normalizer;
}
}
}