1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV4\edmx; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
6
|
|
|
use AlgoWeb\ODataMetadata\xsdRestrictions; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class representing TIncludeAnnotationsType |
10
|
|
|
* |
11
|
|
|
* |
12
|
|
|
* XSD Type: TIncludeAnnotations |
13
|
|
|
*/ |
14
|
|
|
class TIncludeAnnotationsType extends IsOK |
15
|
|
|
{ |
16
|
|
|
use xsdRestrictions; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @property string $termNamespace |
20
|
|
|
*/ |
21
|
|
|
private $termNamespace = null; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @property string $qualifier |
25
|
|
|
*/ |
26
|
|
|
private $qualifier = null; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @property string $targetNamespace |
30
|
|
|
*/ |
31
|
|
|
private $targetNamespace = null; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Gets as termNamespace |
35
|
|
|
* |
36
|
|
|
* @return string |
37
|
|
|
*/ |
38
|
|
|
public function getTermNamespace() |
39
|
|
|
{ |
40
|
|
|
return $this->termNamespace; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Sets a new termNamespace |
45
|
|
|
* |
46
|
|
|
* @param string $termNamespace |
47
|
|
|
* @return self |
48
|
|
|
*/ |
49
|
|
|
public function setTermNamespace($termNamespace) |
50
|
|
|
{ |
51
|
|
|
$this->termNamespace = $termNamespace; |
52
|
|
|
return $this; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Gets as qualifier |
57
|
|
|
* |
58
|
|
|
* @return string |
59
|
|
|
*/ |
60
|
|
|
public function getQualifier() |
61
|
|
|
{ |
62
|
|
|
return $this->qualifier; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Sets a new qualifier |
67
|
|
|
* |
68
|
|
|
* @param string $qualifier |
69
|
|
|
* @return self |
70
|
|
|
*/ |
71
|
|
|
public function setQualifier($qualifier) |
72
|
|
|
{ |
73
|
|
|
$this->qualifier = $qualifier; |
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Gets as targetNamespace |
79
|
|
|
* |
80
|
|
|
* @return string |
81
|
|
|
*/ |
82
|
|
|
public function getTargetNamespace() |
83
|
|
|
{ |
84
|
|
|
return $this->targetNamespace; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Sets a new targetNamespace |
89
|
|
|
* |
90
|
|
|
* @param string $targetNamespace |
91
|
|
|
* @return self |
92
|
|
|
*/ |
93
|
|
|
public function setTargetNamespace($targetNamespace) |
94
|
|
|
{ |
95
|
|
|
$this->targetNamespace = $targetNamespace; |
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
protected function IsOK(&$msg) |
100
|
|
|
{ |
101
|
|
|
if (!$this->isStringNotNullOrEmpty($this->termNamespace)) { |
102
|
|
|
$msg = "Term Namespace Must be defined"; |
103
|
|
|
return false; |
104
|
|
|
} |
105
|
|
|
if (!$this->isNCName($this->termNamespace)) { |
106
|
|
|
$msg = "Term Namespace Must be a valid NCName"; |
107
|
|
|
return false; |
108
|
|
|
} |
109
|
|
|
//<!-- one or more SimpleIdentifiers separated by dots --> |
110
|
|
|
if (!$this->MatchesRegexPattern("[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}", $this->termNamespace)) { |
111
|
|
|
$msg = "the term namespace dose not match the regex in the xsd."; |
112
|
|
|
return false; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
if (null != $this->qualifier) { |
116
|
|
|
if (!is_string($this->qualifier)) { |
117
|
|
|
$msg = "qualifier must be either a string or null"; |
118
|
|
|
return false; |
119
|
|
|
} |
120
|
|
|
if (!$this->isNCName($this->qualifier)) { |
121
|
|
|
$msg = "qualifier Must be a valid NCName"; |
122
|
|
|
return false; |
123
|
|
|
} |
124
|
|
|
if (strlen($this->qualifier > 128)) { |
125
|
|
|
$msg = "the maximum length permitted for qualifier is 128"; |
126
|
|
|
return false; |
127
|
|
|
} |
128
|
|
|
// <!-- ECMAScript identifiers not starting with a '$' --> |
129
|
|
|
if (!$this->MatchesRegexPattern("[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}", $this->qualifier)) { |
130
|
|
|
$msg = "the qualifier dose not match the regex in the xsd."; |
131
|
|
|
return false; |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
if (null != $this->targetNamespace) { |
135
|
|
|
if (!is_string($this->targetNamespace)) { |
136
|
|
|
$msg = "targetNamespace must be either a string or null"; |
137
|
|
|
return false; |
138
|
|
|
} |
139
|
|
|
if (!$this->isNCName($this->targetNamespace)) { |
140
|
|
|
$msg = "targetNamespace Must be a valid NCName"; |
141
|
|
|
return false; |
142
|
|
|
} |
143
|
|
|
//<!-- one or more SimpleIdentifiers separated by dots --> |
144
|
|
|
if (!$this->MatchesRegexPattern("[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}", $this->targetNamespace)) { |
145
|
|
|
$msg = "the targetNamespace dose not match the regex in the xsd."; |
146
|
|
|
return false; |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
return true; |
150
|
|
|
} |
151
|
|
|
} |
152
|
|
|
|