Desc   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 14
dl 0
loc 40
c 0
b 0
f 0
ccs 15
cts 15
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getXML() 0 7 1
A setData() 0 13 2
A getDefaultDto() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace kalanis\Pohoda\Contract;
6
7
use kalanis\Pohoda\AbstractAgenda;
8
use kalanis\Pohoda\Common;
9
use kalanis\Pohoda\Type\Address;
10
11
/**
12
 * @property DescDto $data
13
 */
14
class Desc extends AbstractAgenda
15
{
16
    use Common\AddParameterTrait;
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 4
    public function setData(Common\Dtos\AbstractDto $data): parent
22
    {
23
        // process partner identity
24 4
        if (isset($data->partnerIdentity)) {
25 1
            $partnerIdentity = new Address($this->dependenciesFactory);
26 1
            $partnerIdentity
27 1
                ->setDirectionalVariable($this->useOneDirectionalVariables)
28 1
                ->setResolveOptions($this->resolveOptions)
29 1
                ->setData($data->partnerIdentity);
30 1
            $data->partnerIdentity = $partnerIdentity;
31
        }
32
33 4
        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...
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 3
    public function getXML(): \SimpleXMLElement
40
    {
41 3
        $xml = $this->createXML()->addChild('con:contractDesc', '', $this->namespace('con'));
42
43 3
        $this->addElements($xml, $this->getDataElements(), 'con');
44
45 3
        return $xml;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51 4
    protected function getDefaultDto(): Common\Dtos\AbstractDto
52
    {
53 4
        return new DescDto();
54
    }
55
}
56