Issues (1574)

Serializer/AddIdentificationUriEventSubscriber.php (15 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
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
Missing @category tag in class comment
Loading history...
Missing @package tag in class comment
Loading history...
Missing @author tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
13
class AddIdentificationUriEventSubscriber implements EventSubscriberInterface
14
{
15
    private string $documentUri;
0 ignored issues
show
Private member variable "documentUri" must be prefixed with an underscore
Loading history...
16
17
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
18
     * @param string|null $documentUri
0 ignored issues
show
Missing parameter comment
Loading history...
19
     */
20 13
    public function __construct(string $documentUri)
21
    {
22 13
        $this->documentUri = $documentUri;
23 13
    }
24
25
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
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
Missing parameter comment
Loading history...
44
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
45 8
    public function addGetReportUri(ObjectEvent $event): void
46
    {
47
        /** @var Verslag $report */
0 ignored issues
show
The open comment tag must be the only content on the line
Loading history...
Missing short description in doc comment
Loading history...
The close comment tag must be the only content on the line
Loading history...
48 8
        $report = $event->getObject();
49
50 8
        if ($report->kenmerk) {
51 8
            $report->uri = $this->documentUri . $report->kenmerk;
52
        }
53 8
    }
54
}
55