@param $data
@param $type
@param $format

@return null|DenormalizerInterface
774642
protected function getDenormalizer($data, $type, $format)
    {
        foreach ($this->denormalizers as $denormalizer) {
            if ($denormalizer->supportsDenormalization($data, $type, $format)) {
                return $denormalizer;
            }
        }
        return null;
    }
768460
public function show($type = null, $format = null)
    {
        $messages = $this->getMessagesForRender($type);

        $this->groupForRender = array();

        $output = '';

        foreach ($messages as $message) {
            if (!$message->isFlash()) {
                if (!is_null($format)) {
                    $message->setFormat($format);
                }

                $output .= $message->render();
            }
        }

        return $output;
    }
551030
public static function sanitizeForSerialization($data, $type = null, $format = null)
    {
        if (is_scalar($data) || null === $data) {
            return $data;
        } elseif ($data instanceof \DateTime) {
            return ($format === 'date') ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM);
        } elseif (is_array($data)) {
            foreach ($data as $property => $value) {
                $data[$property] = self::sanitizeForSerialization($value);
            }
            return $data;
        } elseif (is_object($data)) {
            $values = [];
            $formats = $data::openAPIFormats();
            foreach ($data::openAPITypes() as $property => $openAPIType) {
                $getter = $data::getters()[$property];
                $value = $data->$getter();
                if ($value !== null
                    && !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)
                    && method_exists($openAPIType, 'getAllowableEnumValues')
                    && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) {
                    $imploded = implode("', '", $openAPIType::getAllowableEnumValues());
                    throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'");
                }
                if ($value !== null) {
                    $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
                }
            }
            return (object)$values;
        } else {
            return (string)$data;
        }
    }
422533
protected function denormalizeProperty($data, $class, $name, $format = null, array $context = array())
    {
        if (!($_class = $this->getClassFromArray($data))) {
            return parent::denormalizeProperty($data, $class, $name, $format, $context);
        }

        $class = $_class;
        if (!$this->serializer instanceof DenormalizerInterface) {
            $message = 'Cannot denormalize attribute "%s" because injected serializer is not a denormalizer';
            throw new RuntimeException(sprintf($message, $name));
        }

        return $this->serializer->denormalize($data, $class, $format, $context);
    }
843099
public function denormalize($data, $class, $format = null, array $context = [])
    {
        // Avoid issues with proxies if we populated the object
        if (isset($data['id']) && !isset($context[self::OBJECT_TO_POPULATE])) {
            if (isset($context['api_allow_update']) && true !== $context['api_allow_update']) {
                throw new NotNormalizableValueException('Update is not allowed for this operation.');
            }

            if (isset($context['resource_class'])) {
                $this->updateObjectToPopulate($data, $context);
            } else {
                // See https://github.com/api-platform/core/pull/2326 to understand this message.
                $this->logger->warning('The "resource_class" key is missing from the context.', [
                    'context' => $context,
                ]);
            }
        }

        return parent::denormalize($data, $class, $format, $context);
    }
461256
public function supportsDenormalization($data, $type, $format = null)
    {
        return in_array($type, static::$types)
           and is_string($data) and preg_match(static::SIMPLE_REGEX, $data) > 0;
    }
1086857
public function parse( $data = null, $type = null, $delimiter = null ) {

		if ( ! empty( $data ) ) {
			$this->input = $data;
		}

		if ( ! empty( $type ) && in_array( $type, $this->types, true ) ) {
			$this->type = $type;
		}

		if ( !empty( $delimiter ) )
			$this->delimiter = $delimiter;

		if ( method_exists( $this, "parse_{$this->type}" ) ) {
			return call_user_func( array( $this, 'parse_' . $this->type ) );
		}

		return $this->parsed;
	}
58603
public static function createFromFormat($format, $time, $timezone = null)
    {
        $parent = parent::createFromFormat($format, $time);

        if (empty($parent)) {
            throw new TypeException('Could not create Date from the given format');
        }

        $timestamp = $parent->getTimestamp();
        $date = new self();
        $date->setTimestamp($timestamp);

        return $date;
    }
1025564
public static function formatDate($date, $format = 'Y-m-d')
    {
        if (!$date) {
            return null;
        }
        $date = new DateTime($date);
        return $date->format($format);
    }
414966
public function denormalize($data, $class, $format = null, array $context = [])
    {
        $resolver = new OptionsResolver();
        $this->configureDenormalizeOptions($resolver);
        $options = $resolver->resolve(array_key_exists(self::OPTION_KEY, $context) ? $context[self::OPTION_KEY] : []);

        $entityManager = $this->doctrine->getManagerForClass($class);
        if (!$entityManager instanceof EntityManagerInterface) {
            throw new \UnexpectedValueException("No manager found for class {$class}");
        }
        $repository = $entityManager->getRepository($class);

        if (empty($data)) {
            return null;
        }

        if (is_scalar($data)) {
            // Test base identifier
            /** @var ResourceInterface $resource */
            $resource = $repository->find($data);
            if (null === $resource) {
                $resource = $repository->findOneBy(['path' => $data]);
            }
            if ($resource) {
                return $resource;
            }

            return $this->uploadFile($data, $class, $options);
        }

        /** @noinspection PhpIncompatibleReturnTypeInspection */

        return parent::denormalize($data, $class, $format, $context);
    }
215774
public function denormalize($data, $class, $format = null, array $context = array())
    {
        $allowedAttributes = $this->getAllowedAttributes($class, $context, true);
        $normalizedData = $this->prepareForDenormalization($data);

        $reflectionClass = new \ReflectionClass($class);
        $subcontext = array_merge($context, array('format' => $format));
        $object = $this->instantiateObject($normalizedData, $class, $subcontext, $reflectionClass, $allowedAttributes);

        $classMethods = get_class_methods($object);

        foreach ($normalizedData as $attribute => $value) {
            if ($this->nameConverter) {
                $attribute = $this->nameConverter->denormalize($attribute);
            }

            $allowed = $allowedAttributes === false || in_array($attribute, $allowedAttributes);
            $ignored = in_array($attribute, $this->ignoredAttributes);

            if (!$allowed || $ignored) {
                continue;
            }

            $setter = 'set'.ucfirst($attribute);
            if (!in_array($setter, $classMethods)) {
                continue;
            }

            $value = $this->denormalizeProperty($value, $class, $attribute, $format, $context);

            $object->$setter($value);
        }

        return $object;
    }
1374439
public function output($data, $format = null)
    {
        $contentType = $this->outputContentType($format);

        try {
            $content = $this->serializeData($data, $contentType);
        } catch (\UnexpectedValueException $e) {
            if (!isset($format) && isset($this->defaultFormat) && $this->defaultFormat !== $contentType) {
                $this->output($data, $this->defaultFormat); // Try default format instead
                return;
            }
            
            throw $e;
        }

        $this->getResponse()->getBody()->write($content);
    }
1212787
public function getDataOcorrencia($format = 'd/m/Y')
    {
        return $this->dataOcorrencia instanceof Carbon
        ? $format === false ? $this->dataOcorrencia : $this->dataOcorrencia->format($format)
        : null;
    }
131624
public function normalize($object, $format = null, array $context = [])
    {
        foreach ($this->normalizers as $normalizer) {
            // Return the result from the first denormalizer that can
            // denormalize this.
            if ($normalizer->supportsNormalization($object, $format)) {
                return $normalizer->normalize($object, $format, $context);
            }
        }
    }
1007210
public function decode($data, $format, array $context = array())
    {
        $result = null;
        parse_str($data, $result);
        return $result;
    }
450309
protected function denormalizeParam($data, $param, $format, $context)
    {
        $name = $param->getName();
        $index = $param->getPosition();

        if (array_key_exists($name, $data)) {
            $value = $data[$name];
        } elseif (array_key_exists($index, $data)) {
            $value = $data[$index];
        } elseif ($param->isDefaultValueAvailable()) {
            $value = $param->getDefaultValue();
        } else {
            $message = sprintf('Missing parameter #%s: %s', $index, $name);
            throw new \RuntimeException($message);
        }

        if ($param->getClass()) {
            $class = $param->getClass()->getName();
        } elseif ($this->serializer->supportsDenormalization($value, MixedDenormalizer::TYPE, $format)) {
            $class = MixedDenormalizer::TYPE;
        }

        if (isset($class)) {
            $value = $this->serializer->denormalize($value, $class, $format, $context);
        }

        return $value;
    }
1013990
private function navigate(
        $data,
        $direction,
        $format,
        ContextInterface $context = null,
        TypeMetadataInterface $type = null
    ) {
        $visitor = $this->visitorRegistry->getVisitor($direction, $format);

        $context = $context ?: new Context();
        $context->initialize($this->navigator, $visitor, $direction, $format);
        $this->navigator->navigate($visitor->prepare($data, $context), $context, $type);

        return $visitor->getResult();
    }