Desc::getDefaultDto()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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