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
|
|
View Code Duplication |
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 TSimpleIdentifier"; |
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
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.