AddressInternetType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 22
c 0
b 0
f 0
dl 0
loc 42
ccs 22
cts 22
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getXML() 0 7 1
A configureOptions() 0 22 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\OptionsResolver;
16
17
class AddressInternetType extends AbstractAgenda
18
{
19
    /** @var string[] */
20
    protected array $elements = ['company', 'title', 'surname', 'name', 'city', 'street', 'number', 'zip', 'ico', 'dic', 'icDph', 'phone', 'mobilPhone', 'fax', 'email', 'www'];
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 23
    public function getXML(): \SimpleXMLElement
26
    {
27 23
        $xml = $this->createXML()->addChild('typ:address', '', $this->namespace('typ'));
28
29 23
        $this->addElements($xml, $this->elements, 'typ');
30
31 23
        return $xml;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 1
    protected function configureOptions(OptionsResolver $resolver): void
38
    {
39
        // available options
40 1
        $resolver->setDefined($this->elements);
41
42
        // validate / format options
43 1
        $resolver->setNormalizer('company', $this->normalizerFactory->getClosure('string255'));
44 1
        $resolver->setNormalizer('title', $this->normalizerFactory->getClosure('string7'));
45 1
        $resolver->setNormalizer('surname', $this->normalizerFactory->getClosure('string32'));
46 1
        $resolver->setNormalizer('name', $this->normalizerFactory->getClosure('string32'));
47 1
        $resolver->setNormalizer('city', $this->normalizerFactory->getClosure('string45'));
48 1
        $resolver->setNormalizer('street', $this->normalizerFactory->getClosure('string45'));
49 1
        $resolver->setNormalizer('number', $this->normalizerFactory->getClosure('string10'));
50 1
        $resolver->setNormalizer('zip', $this->normalizerFactory->getClosure('string15'));
51 1
        $resolver->setNormalizer('ico', $this->normalizerFactory->getClosure('string15'));
52 1
        $resolver->setNormalizer('dic', $this->normalizerFactory->getClosure('string18'));
53 1
        $resolver->setNormalizer('icDph', $this->normalizerFactory->getClosure('string18'));
54 1
        $resolver->setNormalizer('phone', $this->normalizerFactory->getClosure('string40'));
55 1
        $resolver->setNormalizer('mobilPhone', $this->normalizerFactory->getClosure('string24'));
56 1
        $resolver->setNormalizer('fax', $this->normalizerFactory->getClosure('string24'));
57 1
        $resolver->setNormalizer('email', $this->normalizerFactory->getClosure('string64'));
58 1
        $resolver->setNormalizer('www', $this->normalizerFactory->getClosure('string32'));
59
    }
60
}
61