1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\App; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
6
|
|
|
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class representing AppServiceType |
10
|
|
|
* |
11
|
|
|
* |
12
|
|
|
* XSD Type: appServiceType |
13
|
|
|
*/ |
14
|
|
View Code Duplication |
class AppServiceType extends IsOK |
|
|
|
|
15
|
|
|
{ |
16
|
|
|
use IsOKToolboxTrait; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @property \AlgoWeb\ODataMetadata\Atom\Author $author |
20
|
|
|
*/ |
21
|
|
|
private $author = null; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @property \AlgoWeb\ODataMetadata\App\Workspace[] $workspace |
25
|
|
|
*/ |
26
|
|
|
private $workspace = array(); |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Gets as author |
30
|
|
|
* |
31
|
|
|
* @return \AlgoWeb\ODataMetadata\Atom\Author |
32
|
|
|
*/ |
33
|
|
|
public function getAuthor() |
34
|
|
|
{ |
35
|
|
|
return $this->author; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Sets a new author |
40
|
|
|
* |
41
|
|
|
* @param \AlgoWeb\ODataMetadata\Atom\Author $author |
42
|
|
|
* @return self |
43
|
|
|
*/ |
44
|
|
|
public function setAuthor(\AlgoWeb\ODataMetadata\Atom\Author $author) |
45
|
|
|
{ |
46
|
|
|
$this->author = $author; |
47
|
|
|
return $this; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Adds as workspace |
52
|
|
|
* |
53
|
|
|
* @return self |
54
|
|
|
* @param \AlgoWeb\ODataMetadata\App\Workspace $workspace |
55
|
|
|
*/ |
56
|
|
|
public function addToWorkspace(\AlgoWeb\ODataMetadata\App\Workspace $workspace) |
57
|
|
|
{ |
58
|
|
|
$this->workspace[] = $workspace; |
59
|
|
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* isset workspace |
64
|
|
|
* |
65
|
|
|
* @param scalar $index |
66
|
|
|
* @return boolean |
67
|
|
|
*/ |
68
|
|
|
public function issetWorkspace($index) |
69
|
|
|
{ |
70
|
|
|
return isset($this->workspace[$index]); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* unset workspace |
75
|
|
|
* |
76
|
|
|
* @param scalar $index |
77
|
|
|
* @return void |
78
|
|
|
*/ |
79
|
|
|
public function unsetWorkspace($index) |
80
|
|
|
{ |
81
|
|
|
unset($this->workspace[$index]); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Gets as workspace |
86
|
|
|
* |
87
|
|
|
* @return \AlgoWeb\ODataMetadata\App\Workspace[] |
88
|
|
|
*/ |
89
|
|
|
public function getWorkspace() |
90
|
|
|
{ |
91
|
|
|
return $this->workspace; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Sets a new workspace |
96
|
|
|
* |
97
|
|
|
* @param \AlgoWeb\ODataMetadata\App\Workspace[] $workspace |
98
|
|
|
* @return self |
99
|
|
|
*/ |
100
|
|
|
public function setWorkspace(array $workspace) |
101
|
|
|
{ |
102
|
|
|
$this->workspace = $workspace; |
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function isOK(&$msg = null) |
107
|
|
|
{ |
108
|
|
|
if (!$this->isObjectNullOrType('\AlgoWeb\ODataMetadata\Atom\Author', $this->author, $msg)) { |
|
|
|
|
109
|
|
|
return false; |
110
|
|
|
} |
111
|
|
|
if ($this->isObjectNullOrOK($this->author, $msg)) { |
|
|
|
|
112
|
|
|
return false; |
113
|
|
|
} |
114
|
|
|
if ($this->isValidArrayOK($this->workspace, '\AlgoWeb\ODataMetadata\App\Workspace', $msg, 1)) { |
115
|
|
|
return false; |
116
|
|
|
} |
117
|
|
|
return true; |
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
|
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.