MyAddress   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 18
dl 0
loc 37
c 0
b 0
f 0
ccs 18
cts 18
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultDto() 0 3 1
A setData() 0 22 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace kalanis\Pohoda\Type;
6
7
use kalanis\Pohoda\AbstractAgenda;
8
use kalanis\Pohoda\Common;
9
10
/**
11
 * @property Dtos\MyAddressDto $data
12
 */
13
class MyAddress extends AbstractAgenda
14
{
15
    use Common\SetNamespaceTrait;
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 28
    public function setData(Common\Dtos\AbstractDto $data): parent
21
    {
22
        // process address
23 28
        if (isset($data->address)) {
24 27
            $address = new AddressInternetType($this->dependenciesFactory);
25 27
            $address
26 27
                ->setDirectionalVariable($this->useOneDirectionalVariables)
27 27
                ->setResolveOptions($this->resolveOptions)
28 27
                ->setData($data->address);
29 27
            $data->address = $address;
30
        }
31
        // process establishment
32 28
        if (isset($data->establishment)) {
33 1
            $establishment = new EstablishmentType($this->dependenciesFactory);
34 1
            $establishment
35 1
                ->setDirectionalVariable($this->useOneDirectionalVariables)
36 1
                ->setResolveOptions($this->resolveOptions)
37 1
                ->setData($data->establishment);
38 1
            $data->establishment = $establishment;
39
        }
40
41 28
        return parent::setData($data);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::setData($data) returns the type kalanis\Pohoda\AbstractAgenda which is incompatible with the type-hinted return parent.
Loading history...
42
    }
43
44
    /**
45
     * {@inheritDoc}
46
     */
47 28
    protected function getDefaultDto(): Common\Dtos\AbstractDto
48
    {
49 28
        return new Dtos\MyAddressDto();
50
    }
51
}
52