Record   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 15
c 1
b 0
f 1
dl 0
loc 41
ccs 17
cts 17
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getXML() 0 8 1
A configureOptions() 0 7 1
A setData() 0 11 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->dependenciesFactory);
26 3
        $filter
27 3
            ->setDirectionalVariable($this->useOneDirectionalVariables)
28 3
            ->setResolveOptions($this->resolveOptions)
29 3
            ->setData($data['filter']);
30 3
        $data['filter'] = $filter;
31
32 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...
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 2
    public function getXML(): \SimpleXMLElement
39
    {
40 2
        $xml = $this->createXML()->addChild('prn:record', '', $this->namespace('prn'));
41 2
        $xml->addAttribute('agenda', strval($this->data['agenda']));
42
43 2
        $this->addElements($xml, ['filter'], 'prn');
44
45 2
        return $xml;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51 1
    protected function configureOptions(Common\OptionsResolver $resolver): void
52
    {
53
        // available options
54 1
        $resolver->setDefined(['agenda', 'filter']);
55
56 1
        $resolver->setRequired('agenda');
57 1
        $resolver->setRequired('filter');
58
    }
59
}
60