Conditions | 4 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
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 (!is_string($value) || '' === $trimmedValue = trim($value)) { |
|
41 | 6 | $this->fieldDenormalizer->denormalizeField($path, $object, $value, $context, $denormalizer); |
|
42 | |||
43 | 6 | return; |
|
44 | } |
||
45 | |||
46 | try { |
||
47 | 4 | $value = new \DateTime($trimmedValue); |
|
48 | 3 | } catch (\Exception $exception) { |
|
49 | 3 | error_clear_last(); |
|
50 | } |
||
51 | |||
52 | 4 | $this->fieldDenormalizer->denormalizeField($path, $object, $value, $context, $denormalizer); |
|
53 | 4 | } |
|
54 | } |
||
55 |