Passed
Push — master ( cedc01...8bcd2b )
by Christopher
02:32
created

HasAccessors::getAttributesHasAccessors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
6
namespace AlgoWeb\ODataMetadata\MetadataV3\Edm\Concerns;
7
8
use AlgoWeb\ODataMetadata\MetadataV3\AccessorType;
9
use AlgoWeb\ODataMetadata\MetadataV3\Edm\EdmBase;
10
use AlgoWeb\ODataMetadata\Writer\AttributeContainer;
11
use DOMElement;
12
13
/**
14
 * Trait HasAccessors.
15
 * @mixin EdmBase
16
 */
17
trait HasAccessors
18
{
19
    /**
20
     * @var AccessorType $setterAccess
21
     */
22
    private $setterAccess = null;
23
24
    /**
25
     * @var AccessorType $getterAccess
26
     */
27
    private $getterAccess = null;
28
    /**
29
     * Gets as setterAccess.
30
     *
31
     * @return string
32
     */
33
    public function getSetterAccess()
34
    {
35
        return $this->setterAccess;
36
    }
37
38
    /**
39
     * Sets a new setterAccess.
40
     *
41
     * @param  AccessorType $setterAccess
42
     * @return self
43
     */
44
    public function setSetterAccess(?AccessorType $setterAccess): self
45
    {
46
        $this->setterAccess = $setterAccess;
47
        return $this;
48
    }
49
50
    /**
51
     * Gets as getterAccess.
52
     *
53
     * @return AccessorType|null
54
     */
55
    public function getGetterAccess(): ?AccessorType
56
    {
57
        return $this->getterAccess;
58
    }
59
60
    /**
61
     * Sets a new getterAccess.
62
     *
63
     * @param  AccessorType $getterAccess
64
     * @return self
65
     */
66
    public function setGetterAccess(?AccessorType$getterAccess): self
67
    {
68
        $this->getterAccess = $getterAccess;
69
        return $this;
70
    }
71
72
    public function getAttributesHasAccessors(): array
73
    {
74
        return [
75
            new AttributeContainer('cg:SetterAccess', $this->getSetterAccess(), true),
76
            new AttributeContainer('cg:GetterAccess', $this->getGetterAccess(), true)
77
        ];
78
    }
79
}
80