Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
44 | 3 | public function denormalizeField( |
|
45 | string $path, |
||
46 | $object, |
||
47 | $value, |
||
48 | DenormalizerContextInterface $context, |
||
49 | DenormalizerInterface $denormalizer = null |
||
50 | ) { |
||
51 | 3 | if (null === $value) { |
|
52 | 1 | $this->accessor->setValue($object, $value); |
|
53 | |||
54 | 1 | return; |
|
55 | } |
||
56 | |||
57 | 2 | if (!is_string($value)) { |
|
58 | 1 | throw DeserializerRuntimeException::createInvalidDataType($path, gettype($value), 'string'); |
|
59 | } |
||
60 | |||
61 | 1 | $repository = $this->repository; |
|
62 | |||
63 | 1 | $this->accessor->setValue($object, $repository($value)); |
|
64 | 1 | } |
|
65 | } |
||
66 |