Conditions | 5 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
33 | 10 | public function denormalizeField( |
|
34 | string $path, |
||
35 | $object, |
||
36 | $value, |
||
37 | DenormalizerContextInterface $context, |
||
38 | DenormalizerInterface $denormalizer = null |
||
39 | ) { |
||
40 | 10 | if (null === $value || !is_scalar($value) || '' === $trimmedValue = trim((string) $value)) { |
|
41 | 5 | $this->fieldDenormalizer->denormalizeField($path, $object, $value, $context, $denormalizer); |
|
42 | |||
43 | 5 | return; |
|
44 | } |
||
45 | |||
46 | try { |
||
47 | 5 | $value = new \DateTime($trimmedValue); |
|
48 | 4 | } catch (\Exception $exception) { |
|
|
|||
49 | } |
||
50 | |||
51 | 5 | $this->fieldDenormalizer->denormalizeField($path, $object, $value, $context, $denormalizer); |
|
52 | 5 | } |
|
53 | } |
||
54 |