Passed
Push — master ( 46bec3...dbfdbf )
by Alex
04:19
created

TSchemaType::setNamespace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TQualifiedNameTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TSimpleIdentifierTrait;
8
9
/**
10
 * Class representing TSchemaType
11
 *
12
 *
13
 * XSD Type: TSchema
14
 */
15
class TSchemaType extends IsOK
16
{
17
    use TQualifiedNameTrait, TSimpleIdentifierTrait, GSchemaBodyElementsTrait;
18
    /**
19
     * @property string $namespace
20
     */
21
    private $namespace = null;
22
23
    /**
24
     * @property string $alias
25
     */
26
    private $alias = null;
27
28
    /**
29
     * @property string $provider
30
     */
31
    private $provider = null;
32
33
    /**
34
     * @property string $providerManifestToken
35
     */
36
    private $providerManifestToken = null;
37
38
    /**
39
     * Gets as namespace
40
     *
41
     * @return string
42
     */
43
    public function getNamespace()
44
    {
45
        return $this->namespace;
46
    }
47
48
    /**
49
     * Sets a new namespace
50
     *
51
     * @param string $namespace
52
     * @return self
53
     */
54
    public function setNamespace($namespace)
55
    {
56
        $this->namespace = $namespace;
57
        return $this;
58
    }
59
60
    /**
61
     * Gets as alias
62
     *
63
     * @return string
64
     */
65
    public function getAlias()
66
    {
67
        return $this->alias;
68
    }
69
70
    /**
71
     * Sets a new alias
72
     *
73
     * @param string $alias
74
     * @return self
75
     */
76
    public function setAlias($alias)
77
    {
78
        $this->alias = $alias;
79
        return $this;
80
    }
81
82
    /**
83
     * Gets as provider
84
     *
85
     * @return string
86
     */
87
    public function getProvider()
88
    {
89
        return $this->provider;
90
    }
91
92
    /**
93
     * Sets a new provider
94
     *
95
     * @param string $provider
96
     * @return self
97
     */
98
    public function setProvider($provider)
99
    {
100
        $this->provider = $provider;
101
        return $this;
102
    }
103
104
    /**
105
     * Gets as providerManifestToken
106
     *
107
     * @return string
108
     */
109
    public function getProviderManifestToken()
110
    {
111
        return $this->providerManifestToken;
112
    }
113
114
    /**
115
     * Sets a new providerManifestToken
116
     *
117
     * @param string $providerManifestToken
118
     * @return self
119
     */
120
    public function setProviderManifestToken($providerManifestToken)
121
    {
122
        $this->providerManifestToken = $providerManifestToken;
123
        return $this;
124
    }
125
126
    public function isOK(&$msg = null)
127
    {
128
        if (!$this->isStringNotNullOrEmpty($this->namespace)) {
129
            $msg = "Namespace cannot be null or empty";
130
            return false;
131
        }
132
        if (!$this->isStringNotNullOrEmpty($this->provider)) {
133
            $msg = "Provider cannot be null or empty";
134
            return false;
135
        }
136
        if (!$this->isStringNotNullOrEmpty($this->providerManifestToken)) {
137
            $msg = "Provider manifest token cannot be null or empty";
138
            return false;
139
        }
140
        if (!$this->isStringNotNullOrEmpty($this->alias)) {
141
            $msg = "Alias cannot be empty";
142
            return false;
143
        }
144
        if (!$this->isTQualifiedNameValid($this->namespace)) {
145
            $msg = "Namespace must be valid TQualifiedName";
146
            return false;
147
        }
148
        if (null != $this->alias && !$this->isTSimpleIdentifierValid($this->alias)) {
149
            $msg = "Alias must be valid TSimpleIdentifier";
150
            return false;
151
        }
152
        if (null != $this->providerManifestToken && !$this->isTSimpleIdentifierValid($this->providerManifestToken)) {
153
            $msg = "Provider manifest token must be valid TSimpleIdentifier";
154
            return false;
155
        }
156
        if (!$this->isTSimpleIdentifierValid($this->provider)) {
157
            $msg = "Provider must be valid TSimpleIdentifier";
158
            return false;
159
        }
160
        if (!$this->isBodyElementsOK($msg)) {
161
            return false;
162
        }
163
164
        return true;
165
    }
166
}
167