TaxDocument::setData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 13
c 0
b 0
f 0
ccs 9
cts 9
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
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\TaxDocumentDto $data
12
 */
13
class TaxDocument extends AbstractAgenda
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18 1
    public function setData(Common\Dtos\AbstractDto $data): parent
19
    {
20
        // process source liquidation
21 1
        if (isset($data->sourceLiquidation)) {
22 1
            $sourceLiquidation = new SourceLiquidation($this->dependenciesFactory);
23 1
            $sourceLiquidation
24 1
                ->setDirectionalVariable($this->useOneDirectionalVariables)
25 1
                ->setResolveOptions($this->resolveOptions)
26 1
                ->setData($data->sourceLiquidation);
27 1
            $data->sourceLiquidation = $sourceLiquidation;
28
        }
29
30 1
        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...
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function getXML(): \SimpleXMLElement
37
    {
38 1
        $xml = $this->createXML()->addChild('int:taxDocument', '', $this->namespace('int'));
39
40 1
        $this->addElements($xml, $this->getDataElements(), 'int');
41
42 1
        return $xml;
43
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48 1
    protected function getDefaultDto(): Common\Dtos\AbstractDto
49
    {
50 1
        return new Dtos\TaxDocumentDto();
51
    }
52
}
53