Passed
Push — master ( 067151...1e051c )
by Petr
13:11
created

Record   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getXML() 0 8 1
A configureOptions() 0 7 1
A setData() 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\PrintRequest;
13
14
use Riesenia\Pohoda\AbstractAgenda;
15
use Riesenia\Pohoda\Common;
16
17
class Record extends AbstractAgenda
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 3
    public function setData(array $data): parent
23
    {
24
        // process filter
25 3
        $filter = new Filter($this->namespacesPaths, $this->sanitizeEncoding, $this->companyRegistrationNumber, $this->resolveOptions, $this->normalizerFactory);
26 3
        $data['filter'] = $filter->setDirectionalVariable($this->useOneDirectionalVariables)->setData($data['filter']);
27
28 3
        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...
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 2
    public function getXML(): \SimpleXMLElement
35
    {
36 2
        $xml = $this->createXML()->addChild('prn:record', '', $this->namespace('prn'));
37 2
        $xml->addAttribute('agenda', strval($this->data['agenda']));
38
39 2
        $this->addElements($xml, ['filter'], 'prn');
40
41 2
        return $xml;
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47 1
    protected function configureOptions(Common\OptionsResolver $resolver): void
48
    {
49
        // available options
50 1
        $resolver->setDefined(['agenda', 'filter']);
51
52 1
        $resolver->setRequired('agenda');
53 1
        $resolver->setRequired('filter');
54
    }
55
}
56