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