TaxDocument   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultDto() 0 3 1
A setData() 0 13 2
A getXML() 0 7 1
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