IssueSlip::getImportRoot()   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
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
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;
13
14
/**
15
 * @property array{
16
 *     links?: iterable<Type\Link>,
17
 * } $data
18
 */
19
class IssueSlip extends AbstractDocument
20
{
21 6
    public function getImportRoot(): string
22
    {
23 6
        return 'lst:vydejka';
24
    }
25
26
    /**
27
     * Add link.
28
     *
29
     * @param array<string,mixed> $data
30
     *
31
     * @return $this
32
     */
33 1
    public function addLink(array $data): self
34
    {
35 1
        if (!isset($this->data['links'])
36 1
            || !(
37 1
                is_array($this->data['links'])
38 1
                || (is_a($this->data['links'], \ArrayAccess::class))
39 1
            )
40
        ) {
41 1
            $this->data['links'] = [];
42
        }
43
44 1
        $link = new Type\Link($this->namespacesPaths, $this->sanitizeEncoding, $this->normalizerFactory);
45 1
        $link->setDirectionalVariable($this->useOneDirectionalVariables)->setResolveOptions($this->resolveOptions)->setData($data);
46 1
        $this->data['links'][] = $link;
47
48 1
        return $this;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 5
    protected function getDocumentElements(): array
55
    {
56 5
        return \array_merge(parent::getDocumentElements(), ['links']);
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62 6
    protected function getDocumentNamespace(): string
63
    {
64 6
        return 'vyd';
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70 6
    protected function getDocumentName(): string
71
    {
72 6
        return 'vydejka';
73
    }
74
}
75