Intrastat   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 18
c 1
b 0
f 1
dl 0
loc 39
ccs 12
cts 12
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getXML() 0 7 1
A configureOptions() 0 12 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\Stock;
13
14
use Riesenia\Pohoda\AbstractAgenda;
15
use Riesenia\Pohoda\Common\OptionsResolver;
16
17
class Intrastat extends AbstractAgenda
18
{
19
    /** @var string[] */
20
    protected array $elements = [
21
        'goodsCode',
22
        'description',
23
        'statistic',
24
        'unit',
25
        'coefficient',
26
        'country',
27
    ];
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 9
    public function getXML(): \SimpleXMLElement
33
    {
34 9
        $xml = $this->createXML()->addChild('stk:intrastat', '', $this->namespace('stk'));
35
36 9
        $this->addElements($xml, $this->elements, 'stk');
37
38 9
        return $xml;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 2
    protected function configureOptions(OptionsResolver $resolver): void
45
    {
46
        // available options
47 2
        $resolver->setDefined($this->elements);
48
49
        // validate / format options
50 2
        $resolver->setNormalizer('goodsCode', $this->dependenciesFactory->getNormalizerFactory()->getClosure('string8'));
51 2
        $resolver->setNormalizer('description', $this->dependenciesFactory->getNormalizerFactory()->getClosure('string255'));
52 2
        $resolver->setNormalizer('statistic', $this->dependenciesFactory->getNormalizerFactory()->getClosure('string2'));
53 2
        $resolver->setNormalizer('unit', $this->dependenciesFactory->getNormalizerFactory()->getClosure('string10'));
54 2
        $resolver->setNormalizer('coefficient', $this->dependenciesFactory->getNormalizerFactory()->getClosure('float'));
55 2
        $resolver->setNormalizer('country', $this->dependenciesFactory->getNormalizerFactory()->getClosure('string2'));
56
    }
57
}
58