TaxDocument   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
c 1
b 0
f 0
dl 0
loc 41
ccs 11
cts 11
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setData() 0 9 2
A configureOptions() 0 4 1
A getXML() 0 7 1
1
<?php
2
3
/**
4
 * This file is part of riesenia/pohoda package.
5
 *
6
 * Licensed under the MIT License
7
 * (c) RIESENIA.com
8
 */
9
10
declare(strict_types=1);
11
12
namespace Riesenia\Pohoda\Type;
13
14
use Riesenia\Pohoda\AbstractAgenda;
15
use Riesenia\Pohoda\Common;
16
17
class TaxDocument extends AbstractAgenda
18
{
19
    /** @var string[] */
20
    protected array $refElements = [];
21
22
    /** @var string[] */
23
    protected array $elements = ['sourceLiquidation'];
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 1
    public function setData(array $data): parent
29
    {
30
        // process source liquidation
31 1
        if (isset($data['sourceLiquidation'])) {
32 1
            $sourceLiquidation = new SourceLiquidation($this->namespacesPaths, $this->sanitizeEncoding, $this->companyRegistrationNumber, $this->resolveOptions, $this->normalizerFactory);
33 1
            $data['sourceLiquidation'] = $sourceLiquidation->setDirectionalVariable($this->useOneDirectionalVariables)->setData($data['sourceLiquidation']);
34
        }
35
36 1
        return parent::setData($data);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::setData($data) returns the type Riesenia\Pohoda\AbstractAgenda which is incompatible with the type-hinted return parent.
Loading history...
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 1
    public function getXML(): \SimpleXMLElement
43
    {
44 1
        $xml = $this->createXML()->addChild('int:taxDocument', '', $this->namespace('int'));
45
46 1
        $this->addElements($xml, $this->elements, 'int');
47
48 1
        return $xml;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 1
    protected function configureOptions(Common\OptionsResolver $resolver): void
55
    {
56
        // available options
57 1
        $resolver->setDefined($this->elements);
58
    }
59
}
60