Passed
Push — master ( 1e051c...c8cd94 )
by Petr
02:55
created

Limit   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getXML() 0 7 1
A configureOptions() 0 8 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\ListRequest;
13
14
use Riesenia\Pohoda\AbstractAgenda;
15
use Riesenia\Pohoda\Common\OptionsResolver;
16
17
class Limit extends AbstractAgenda
18
{
19
    /** @var string[] */
20
    protected array $elements = ['idFrom', 'count'];
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 2
    public function getXML(): \SimpleXMLElement
26
    {
27 2
        $xml = $this->createXML()->addChild('ftr:limit', '', $this->namespace('ftr'));
28
29 2
        $this->addElements($xml, $this->elements, 'ftr');
30
31 2
        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('idFrom', $this->normalizerFactory->getClosure('int'));
44 1
        $resolver->setNormalizer('count', $this->normalizerFactory->getClosure('int'));
45
    }
46
}
47