1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\mapping\cs; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
6
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\Groups\TModificationFunctionMappingComplexPropertyPropertyGroup; |
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\IsOKTraits\TSimpleIdentifierTrait; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class representing TModificationFunctionMappingComplexPropertyType |
11
|
|
|
* |
12
|
|
|
* Type for function mapping complex property |
13
|
|
|
* |
14
|
|
|
* XSD Type: TModificationFunctionMappingComplexProperty |
15
|
|
|
*/ |
16
|
|
|
class TModificationFunctionMappingComplexPropertyType extends IsOK |
17
|
|
|
{ |
18
|
|
|
use TSimpleIdentifierTrait, TModificationFunctionMappingComplexPropertyPropertyGroup; |
19
|
|
|
/** |
20
|
|
|
* @property string $name |
21
|
|
|
*/ |
22
|
|
|
private $name = null; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @property string $typeName |
26
|
|
|
*/ |
27
|
|
|
private $typeName = null; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TModificationFunctionMappingScalarPropertyType |
31
|
|
|
* $scalarProperty |
32
|
|
|
*/ |
33
|
|
|
private $scalarProperty = null; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TModificationFunctionMappingComplexPropertyType |
37
|
|
|
* $complexProperty |
38
|
|
|
*/ |
39
|
|
|
private $complexProperty = null; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Gets as name |
43
|
|
|
* |
44
|
|
|
* @return string |
45
|
|
|
*/ |
46
|
|
|
public function getName() |
47
|
|
|
{ |
48
|
|
|
return $this->name; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Sets a new name |
53
|
|
|
* |
54
|
|
|
* @param string $name |
55
|
|
|
* @return self |
56
|
|
|
*/ |
57
|
|
|
public function setName($name) |
58
|
|
|
{ |
59
|
|
|
$this->name = $name; |
60
|
|
|
return $this; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Gets as typeName |
65
|
|
|
* |
66
|
|
|
* @return string |
67
|
|
|
*/ |
68
|
|
|
public function getTypeName() |
69
|
|
|
{ |
70
|
|
|
return $this->typeName; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Sets a new typeName |
75
|
|
|
* |
76
|
|
|
* @param string $typeName |
77
|
|
|
* @return self |
78
|
|
|
*/ |
79
|
|
|
public function setTypeName($typeName) |
80
|
|
|
{ |
81
|
|
|
$this->typeName = $typeName; |
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Gets as scalarProperty |
87
|
|
|
* |
88
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TModificationFunctionMappingScalarPropertyType |
89
|
|
|
*/ |
90
|
|
|
public function getScalarProperty() |
91
|
|
|
{ |
92
|
|
|
return $this->scalarProperty; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Sets a new scalarProperty |
97
|
|
|
* |
98
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TModificationFunctionMappingScalarPropertyType |
99
|
|
|
* $scalarProperty |
100
|
|
|
* @return self |
101
|
|
|
*/ |
102
|
|
|
public function setScalarProperty(TModificationFunctionMappingScalarPropertyType $scalarProperty) |
103
|
|
|
{ |
104
|
|
|
$this->scalarProperty = $scalarProperty; |
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Gets as complexProperty |
110
|
|
|
* |
111
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TModificationFunctionMappingComplexPropertyType |
112
|
|
|
*/ |
113
|
|
|
public function getComplexProperty() |
114
|
|
|
{ |
115
|
|
|
return $this->complexProperty; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Sets a new complexProperty |
120
|
|
|
* |
121
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\TModificationFunctionMappingComplexPropertyType |
122
|
|
|
* $complexProperty |
123
|
|
|
* @return self |
124
|
|
|
*/ |
125
|
|
|
public function setComplexProperty(TModificationFunctionMappingComplexPropertyType $complexProperty) |
126
|
|
|
{ |
127
|
|
|
$this->complexProperty = $complexProperty; |
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
View Code Duplication |
public function isOK(&$msg = null) |
|
|
|
|
132
|
|
|
{ |
133
|
|
|
if (!$this->isStringNotNullOrEmpty($this->name)) { |
134
|
|
|
$msg = 'Name cannot be null or empty'; |
135
|
|
|
return false; |
136
|
|
|
} |
137
|
|
|
if (!$this->isStringNotNullOrEmpty($this->typeName)) { |
138
|
|
|
$msg = 'Type name cannot be null or empty'; |
139
|
|
|
return false; |
140
|
|
|
} |
141
|
|
|
if (!$this->isTSimpleIdentifierValid($this->name)) { |
142
|
|
|
$msg = 'Name must be a valid TSimpleIdentifier'; |
143
|
|
|
return false; |
144
|
|
|
} |
145
|
|
|
if (!$this->isComplexPropertyPropertyGroupOK($msg)) { |
146
|
|
|
return false; |
147
|
|
|
} |
148
|
|
|
return true; |
149
|
|
|
} |
150
|
|
|
} |
151
|
|
|
|
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.