Passed
Push — master ( e89c90...b07112 )
by Bas
03:34
created

ClientModelInstantiator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 7
c 1
b 0
f 1
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A construct() 0 8 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\Client;
6
use DMT\Insolvency\Model\ConstructWithClientInterface;
7
use JMS\Serializer\Construction\ObjectConstructorInterface;
8
use JMS\Serializer\DeserializationContext;
9
use JMS\Serializer\Metadata\ClassMetadata;
10
use JMS\Serializer\Visitor\DeserializationVisitorInterface;
11
12
class ClientModelInstantiator implements ObjectConstructorInterface
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class ClientModelInstantiator
Loading history...
13
{
14
    private Client $client;
0 ignored issues
show
Coding Style introduced by
Private member variable "client" must be prefixed with an underscore
Loading history...
15
16
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
17
     * @param Client $client
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
18
     */
19 13
    public function __construct(Client $client)
20
    {
21 13
        $this->client = $client;
22 13
    }
23
24
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $visitor should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $metadata should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $data should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $type should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $context should have a doc-comment as per coding-style.
Loading history...
25
     * @inheritDoc
26
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
27 11
    public function construct(DeserializationVisitorInterface $visitor, ClassMetadata $metadata, $data, array $type, DeserializationContext $context): ?object
28
    {
29 11
        $params = [];
30 11
        if (is_a($metadata->name, ConstructWithClientInterface::class, true)) {
31 7
            $params = [$this->client];
32
        }
33
34 11
        return new $metadata->name(...$params);
35
    }
36
}
37