1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
6
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\GExpressionTrait; |
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\GInlineExpressionsTrait; |
8
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TQualifiedNameTrait; |
9
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class representing TValueAnnotationType |
13
|
|
|
* |
14
|
|
|
* |
15
|
|
|
* XSD Type: TValueAnnotation |
16
|
|
|
*/ |
17
|
|
|
class TValueAnnotationType extends IsOK |
18
|
|
|
{ |
19
|
|
|
use GInlineExpressionsTrait, GExpressionTrait, TSimpleIdentifierTrait, TQualifiedNameTrait; |
20
|
|
|
/** |
21
|
|
|
* @property string $term |
22
|
|
|
*/ |
23
|
|
|
private $term = null; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @property string $qualifier |
27
|
|
|
*/ |
28
|
|
|
private $qualifier = null; |
29
|
|
|
|
30
|
|
|
public function __construct() |
31
|
|
|
{ |
32
|
|
|
$this->gExpressionMaximum = 1; |
33
|
|
|
$this->gExpressionMinimum = 1; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Gets as term |
38
|
|
|
* |
39
|
|
|
* @return string |
40
|
|
|
*/ |
41
|
|
|
public function getTerm() |
42
|
|
|
{ |
43
|
|
|
return $this->term; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Sets a new term |
48
|
|
|
* |
49
|
|
|
* @param string $term |
50
|
|
|
* @return self |
51
|
|
|
*/ |
52
|
|
|
public function setTerm($term) |
53
|
|
|
{ |
54
|
|
|
$this->term = $term; |
55
|
|
|
return $this; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Gets as qualifier |
60
|
|
|
* |
61
|
|
|
* @return string |
62
|
|
|
*/ |
63
|
|
|
public function getQualifier() |
64
|
|
|
{ |
65
|
|
|
return $this->qualifier; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Sets a new qualifier |
70
|
|
|
* |
71
|
|
|
* @param string $qualifier |
72
|
|
|
* @return self |
73
|
|
|
*/ |
74
|
|
|
public function setQualifier($qualifier) |
75
|
|
|
{ |
76
|
|
|
$this->qualifier = $qualifier; |
77
|
|
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
View Code Duplication |
public function isOK(&$msg = null) |
|
|
|
|
81
|
|
|
{ |
82
|
|
|
if (!$this->isTQualifiedNameValid($this->term)) { |
83
|
|
|
$msg = "Term must be a valid TQualifiedName"; |
84
|
|
|
return false; |
85
|
|
|
} |
86
|
|
|
if (null != $this->qualifier && !$this->isTSimpleIdentifierValid($this->qualifier)) { |
87
|
|
|
$msg = "Qualifier must be a valid TSimpleIdentifier"; |
88
|
|
|
return false; |
89
|
|
|
} |
90
|
|
|
if (!$this->isGInlineExpressionsValid($msg)) { |
91
|
|
|
return false; |
92
|
|
|
} |
93
|
|
|
if (!$this->isGExpressionValid($msg)) { |
94
|
|
|
return false; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
return true; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
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.