Passed
Push — master ( 143625...0aa694 )
by Alex
03:46
created

TTypeAnnotationType::isOK()   B

Complexity

Conditions 6
Paths 5

Size

Total Lines 23
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 8.5906
c 0
b 0
f 0
cc 6
eloc 15
nc 5
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\GInlineExpressionsTrait;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TQualifiedNameTrait;
9
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait;
10
11
/**
12
 * Class representing TTypeAnnotationType
13
 *
14
 *
15
 * XSD Type: TTypeAnnotation
16
 */
17
class TTypeAnnotationType extends IsOK
18
{
19
    use IsOKToolboxTrait, GInlineExpressionsTrait, TQualifiedNameTrait, TSimpleIdentifierTrait;
20
    /**
21
     * @property string $term
22
     */
23
    private $term = null;
24
25
    /**
26
     * @property string $qualifier
27
     */
28
    private $qualifier = null;
29
30
    /**
31
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyValueType[] $propertyValue
32
     */
33
    private $propertyValue = [];
34
35
    /**
36
     * Gets as term
37
     *
38
     * @return string
39
     */
40
    public function getTerm()
41
    {
42
        return $this->term;
43
    }
44
45
    /**
46
     * Sets a new term
47
     *
48
     * @param string $term
49
     * @return self
50
     */
51
    public function setTerm($term)
52
    {
53
        $this->term = $term;
54
        return $this;
55
    }
56
57
    /**
58
     * Gets as qualifier
59
     *
60
     * @return string
61
     */
62
    public function getQualifier()
63
    {
64
        return $this->qualifier;
65
    }
66
67
    /**
68
     * Sets a new qualifier
69
     *
70
     * @param string $qualifier
71
     * @return self
72
     */
73
    public function setQualifier($qualifier)
74
    {
75
        $this->qualifier = $qualifier;
76
        return $this;
77
    }
78
79
    /**
80
     * Adds as propertyValue
81
     *
82
     * @return self
83
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyValueType $propertyValue
84
     */
85
    public function addToPropertyValue(TPropertyValueType $propertyValue)
86
    {
87
        $this->propertyValue[] = $propertyValue;
88
        return $this;
89
    }
90
91
    /**
92
     * isset propertyValue
93
     *
94
     * @param scalar $index
95
     * @return boolean
96
     */
97
    public function issetPropertyValue($index)
98
    {
99
        return isset($this->propertyValue[$index]);
100
    }
101
102
    /**
103
     * unset propertyValue
104
     *
105
     * @param scalar $index
106
     * @return void
107
     */
108
    public function unsetPropertyValue($index)
109
    {
110
        unset($this->propertyValue[$index]);
111
    }
112
113
    /**
114
     * Gets as propertyValue
115
     *
116
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyValueType[]
117
     */
118
    public function getPropertyValue()
119
    {
120
        return $this->propertyValue;
121
    }
122
123
    /**
124
     * Sets a new propertyValue
125
     *
126
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyValueType[] $propertyValue
127
     * @return self
128
     */
129
    public function setPropertyValue(array $propertyValue)
130
    {
131
        $this->propertyValue = $propertyValue;
132
        return $this;
133
    }
134
135
    public function isOK(&$msg = null)
136
    {
137
        if (!$this->isTQualifiedNameValid($this->term)) {
138
            $msg = "Term must be a valid TQualifiedName";
139
            return false;
140
        }
141
        if (null != $this->qualifier && !$this->isTSimpleIdentifierValid($this->qualifier)) {
142
            $msg = "Qualifier must be a valid TSimpleIdentifier";
143
            return false;
144
        }
145
        if (!$this->isGInlineExpressionsValid($msg)) {
146
            return false;
147
        }
148
        if (!$this->isValidArrayOK(
149
            $this->propertyValue,
150
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyValueType',
151
            $msg
152
        )) {
153
            return false;
154
        }
155
156
        return true;
157
    }
158
}
159