Category   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 9
c 0
b 0
f 0
dl 0
loc 26
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getXML() 0 7 2
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\Stock;
13
14
use Riesenia\Pohoda\AbstractAgenda;
15
use Riesenia\Pohoda\Common\OptionsResolver;
16
17
class Category extends AbstractAgenda
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 1
    public function getXML(): \SimpleXMLElement
23
    {
24 1
        $category = $this->data['idCategory'] ?? null;
25 1
        return $this->createXML()->addChild(
26 1
            'stk:idCategory',
27 1
            is_null($category) ? null : strval($category),
28 1
            $this->namespace('stk'),
29 1
        );
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 1
    protected function configureOptions(OptionsResolver $resolver): void
36
    {
37
        // available options
38 1
        $resolver->setDefined(['idCategory']);
39
40
        // validate / format options
41 1
        $resolver->setRequired('idCategory');
42 1
        $resolver->setNormalizer('idCategory', $this->normalizerFactory->getClosure('int'));
43
    }
44
}
45