Passed
Push — master ( f20cbe...ecaad3 )
by Christopher
03:19
created

TIncludeAnnotationsType::IsOK()   D

Complexity

Conditions 9
Paths 12

Size

Total Lines 34
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 34
rs 4.909
cc 9
eloc 22
nc 12
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV4\edmx;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV4\edm\IsOKTraits\TNamespaceNameTrait;
7
use AlgoWeb\ODataMetadata\MetadataV4\edm\IsOKTraits\TSimpleIdentifierTrait;
8
9
/**
10
 * Class representing TIncludeAnnotationsType
11
 *
12
 *
13
 * XSD Type: TIncludeAnnotations
14
 */
15
class TIncludeAnnotationsType extends IsOK
16
{
17
    use TNamespaceNameTrait, TSimpleIdentifierTrait;
18
19
    /**
20
     * @property string $termNamespace
21
     */
22
    private $termNamespace = null;
23
24
    /**
25
     * @property string $qualifier
26
     */
27
    private $qualifier = null;
28
29
    /**
30
     * @property string $targetNamespace
31
     */
32
    private $targetNamespace = null;
33
34
    /**
35
     * Gets as termNamespace
36
     *
37
     * @return string
38
     */
39
    public function getTermNamespace()
40
    {
41
        return $this->termNamespace;
42
    }
43
44
    /**
45
     * Sets a new termNamespace
46
     *
47
     * @param string $termNamespace
48
     * @return self
49
     */
50
    public function setTermNamespace($termNamespace)
51
    {
52
        $this->termNamespace = $termNamespace;
53
        return $this;
54
    }
55
56
    /**
57
     * Gets as qualifier
58
     *
59
     * @return string
60
     */
61
    public function getQualifier()
62
    {
63
        return $this->qualifier;
64
    }
65
66
    /**
67
     * Sets a new qualifier
68
     *
69
     * @param string $qualifier
70
     * @return self
71
     */
72
    public function setQualifier($qualifier)
73
    {
74
        $this->qualifier = $qualifier;
75
        return $this;
76
    }
77
78
    /**
79
     * Gets as targetNamespace
80
     *
81
     * @return string
82
     */
83
    public function getTargetNamespace()
84
    {
85
        return $this->targetNamespace;
86
    }
87
88
    /**
89
     * Sets a new targetNamespace
90
     *
91
     * @param string $targetNamespace
92
     * @return self
93
     */
94
    public function setTargetNamespace($targetNamespace)
95
    {
96
        $this->targetNamespace = $targetNamespace;
97
        return $this;
98
    }
99
100
    protected function IsOK(&$msg)
101
    {
102
        if (!$this->isStringNotNullOrEmpty($this->termNamespace)) {
103
            $msg = "Term Namespace Must be defined";
104
            return false;
105
        }
106
        if (!$this->IsTNamespaceNameValid($this->termNamespace)) {
107
            $msg = "Term Namespace Must be a valid NameSpace";
108
            return false;
109
        }
110
111
112
        if (null != $this->qualifier) {
113
            if (!is_string($this->qualifier)) {
114
                $msg = "qualifier must be either a string or null";
115
                return false;
116
            }
117
            if (!$this->IsTSimpleIdentifierValid($this->qualifier)) {
118
                $msg = "qualifier Must be a valid TSimpleIdentifyer";
119
                return false;
120
            }
121
        }
122
        if (null != $this->targetNamespace) {
123
            if (!is_string($this->targetNamespace)) {
124
                $msg = "targetNamespace must be either a string or null";
125
                return false;
126
            }
127
            if (!$this->$this->IsTNamespaceNameValid($this->targetNamespace)) {
128
                $msg = "targetNamespace Must be a valid TNAmespace";
129
                return false;
130
            }
131
        }
132
        return true;
133
    }
134
}
135