Passed
Push — master ( 221c35...fdb910 )
by Petr
02:59
created

ItemUserCode::getXML()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 11
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace kalanis\Pohoda\UserList;
6
7
use kalanis\Pohoda\AbstractAgenda;
8
use kalanis\Pohoda\Common;
9
10
/**
11
 * @property ItemUserCodeDto $data
12
 */
13
class ItemUserCode extends AbstractAgenda
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18 2
    public function getXML(): \SimpleXMLElement
19
    {
20 2
        $xml = $this->createXML()->addChild('lst:itemUserCode', '', $this->namespace('lst'));
21 2
        $xml->addAttribute('code', strval($this->data->code));
22 2
        $xml->addAttribute('name', strval($this->data->name));
23
24 2
        if (isset($this->data->constant)) {
25 1
            $xml->addAttribute('constant', strval($this->data->constant));
26
        }
27
28 2
        return $xml;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 2
    protected function getDefaultDto(): Common\Dtos\AbstractDto
35
    {
36 2
        return new ItemUserCodeDto();
37
    }
38
}
39