1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Serializer\Normalizer; |
4
|
|
|
|
5
|
|
|
use App\Entity\Registration; |
6
|
|
|
use Ds\Component\Config\Service\ConfigService; |
|
|
|
|
7
|
|
|
use Ds\Component\Acl\Serializer\Normalizer\Property\AbstractNormalizer; |
|
|
|
|
8
|
|
|
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; |
|
|
|
|
9
|
|
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface; |
|
|
|
|
10
|
|
|
use Symfony\Component\Serializer\SerializerAwareInterface; |
|
|
|
|
11
|
|
|
use Symfony\Component\Serializer\SerializerInterface; |
|
|
|
|
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class RegistrationNormalizer |
15
|
|
|
*/ |
16
|
|
|
final class RegistrationNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var \Ds\Component\Acl\Serializer\Normalizer\Property\AbstractNormalizer |
20
|
|
|
*/ |
21
|
|
|
private $decorated; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var \Symfony\Component\Serializer\SerializerInterface |
25
|
|
|
*/ |
26
|
|
|
private $serializer; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var \Ds\Component\Config\Service\ConfigService |
30
|
|
|
*/ |
31
|
|
|
private $configService; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Constructor |
35
|
|
|
* |
36
|
|
|
* @param \Ds\Component\Acl\Serializer\Normalizer\Property\AbstractNormalizer $decorated |
37
|
|
|
* @param \Ds\Component\Config\Service\ConfigService $configService |
38
|
|
|
*/ |
39
|
|
|
public function __construct(AbstractNormalizer $decorated, ConfigService $configService) |
40
|
|
|
{ |
41
|
|
|
$this->decorated = $decorated; |
42
|
|
|
$this->configService = $configService; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* {@inheritdoc} |
47
|
|
|
*/ |
48
|
|
|
public function denormalize($data, $class, $format = null, array $context = []) |
49
|
|
|
{ |
50
|
|
|
if (Registration::class === $class) { |
51
|
|
|
|
52
|
|
|
if (!array_key_exists('owner', $data) || null === $data['owner']) { |
53
|
|
|
$key = 'app.registration.'.strtolower($data['identity']); |
54
|
|
|
$data['owner'] = $this->configService->get($key.'.owner.type'); |
55
|
|
|
$data['ownerUuid'] = $this->configService->get($key.'.owner.uuid'); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
return $this->decorated->denormalize($data, $class, $format, $context); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* {@inheritdoc} |
64
|
|
|
*/ |
65
|
|
|
public function normalize($object, $format = null, array $context = []) |
66
|
|
|
{ |
67
|
|
|
$data = $this->decorated->normalize($object, $format, $context); |
68
|
|
|
|
69
|
|
|
return $data; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* {@inheritdoc} |
74
|
|
|
*/ |
75
|
|
|
public function supportsDenormalization($data, $type, $format = null) |
76
|
|
|
{ |
77
|
|
|
return $this->decorated->supportsDenormalization($data, $type, $format); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* {@inheritdoc} |
82
|
|
|
*/ |
83
|
|
|
public function supportsNormalization($data, $format = null) |
84
|
|
|
{ |
85
|
|
|
return $this->decorated->supportsNormalization($data, $format); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* {@inheritdoc} |
90
|
|
|
*/ |
91
|
|
|
public function setSerializer(SerializerInterface $serializer) |
92
|
|
|
{ |
93
|
|
|
$this->serializer = $serializer; |
94
|
|
|
|
95
|
|
|
if ($this->decorated instanceof SerializerAwareInterface) { |
96
|
|
|
$this->decorated->setSerializer($serializer); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths