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

SupplierItem::getDefaultDto()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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