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

Record::setData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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