getSubscribedEvents()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
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
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
13
class AddIdentificationUriEventSubscriber implements EventSubscriberInterface
14
{
15
    private string $documentUri;
0 ignored issues
show
Coding Style introduced by
Private member variable "documentUri" must be prefixed with an underscore
Loading history...
16
17
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
18
     * @param string|null $documentUri
0 ignored issues
show
Coding Style introduced by
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
Coding Style introduced by
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
Coding Style introduced by
Missing parameter comment
Loading history...
44
     */
0 ignored issues
show
Coding Style introduced by
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
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
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