Summary::getDefaultDto()   A
last analyzed

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\Order;
6
7
use kalanis\Pohoda\Common\Dtos;
8
use kalanis\Pohoda\Document\AbstractSummary;
9
use kalanis\PohodaException;
10
11
class Summary extends AbstractSummary
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 5
    public function getXML(): \SimpleXMLElement
17
    {
18 5
        if (is_null($this->namespace)) {
19 1
            throw new PohodaException('Namespace not set.');
20
        }
21
22 4
        if (is_null($this->nodePrefix)) {
23 1
            throw new PohodaException('Node name prefix not set.');
24
        }
25
26 3
        $xml = $this->createXML()->addChild($this->namespace . ':' . $this->nodePrefix . 'Summary', '', $this->namespace($this->namespace));
27
28 3
        $this->addElements($xml, $this->getDataElements(), $this->namespace);
29
30 3
        return $xml;
31
    }
32
33 5
    protected function getDefaultDto(): Dtos\AbstractDto
34
    {
35 5
        return new SummaryDto();
36
    }
37
}
38