1 | <?php |
||
2 | |||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
3 | namespace DMT\Insolvency\Soap\Serializer; |
||
4 | |||
5 | use DMT\Insolvency\Config; |
||
6 | use DMT\Insolvency\Model\Verslag; |
||
7 | use JMS\Serializer\EventDispatcher\EventSubscriberInterface; |
||
8 | use JMS\Serializer\EventDispatcher\ObjectEvent; |
||
9 | |||
10 | /** |
||
11 | * Class AddIdentificationUriEventSubscriber |
||
12 | */ |
||
0 ignored issues
–
show
|
|||
13 | class AddIdentificationUriEventSubscriber implements EventSubscriberInterface |
||
14 | { |
||
15 | private string $documentUri; |
||
0 ignored issues
–
show
|
|||
16 | |||
17 | /** |
||
0 ignored issues
–
show
|
|||
18 | * @param string|null $documentUri |
||
0 ignored issues
–
show
|
|||
19 | */ |
||
20 | 13 | public function __construct(string $documentUri) |
|
21 | { |
||
22 | 13 | $this->documentUri = $documentUri; |
|
23 | 13 | } |
|
24 | |||
25 | /** |
||
0 ignored issues
–
show
|
|||
26 | * @return array |
||
27 | */ |
||
28 | 12 | public static function getSubscribedEvents() |
|
29 | { |
||
30 | return [ |
||
31 | [ |
||
32 | 12 | 'event' => 'serializer.post_deserialize', |
|
33 | 'method' => 'addGetReportUri', |
||
34 | 'format' => 'soap', |
||
35 | 'class' => Verslag::class, |
||
36 | ] |
||
37 | ]; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Add report uri. |
||
42 | * |
||
43 | * @param ObjectEvent $event |
||
0 ignored issues
–
show
|
|||
44 | */ |
||
0 ignored issues
–
show
|
|||
45 | 8 | public function addGetReportUri(ObjectEvent $event): void |
|
46 | { |
||
47 | /** @var Verslag $report */ |
||
0 ignored issues
–
show
|
|||
48 | 8 | $report = $event->getObject(); |
|
49 | |||
50 | 8 | if ($report->kenmerk) { |
|
51 | 8 | $report->uri = $this->documentUri . $report->kenmerk; |
|
52 | } |
||
53 | 8 | } |
|
54 | } |
||
55 |