for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Chubbyphp\Deserialization\Denormalizer;
final class DateFieldDenormalizer implements FieldDenormalizerInterface
{
/**
* @var FieldDenormalizerInterface
*/
private $fieldDenormalizer;
* @param FieldDenormalizerInterface $fieldDenormalizer
public function __construct(FieldDenormalizerInterface $fieldDenormalizer)
$this->fieldDenormalizer = $fieldDenormalizer;
}
* @param string $path
* @param object $object
* @param mixed $value
* @param DenormalizerContextInterface $context
* @param DenormalizerInterface|null $denormalizer
public function denormalizeField(
string $path,
$object,
$value,
DenormalizerContextInterface $context,
DenormalizerInterface $denormalizer = null
) {
try {
$value = new \DateTime($value);
} catch (\Exception $exception) {
$this->fieldDenormalizer->denormalizeField($path, $object, $value, $context, $denormalizer);