AddIdentificationUriEventSubscriber   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
c 1
b 0
f 0
dl 0
loc 39
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 8 1
A addGetReportUri() 0 7 2
A __construct() 0 3 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