Passed
Push — master ( 189420...0898fe )
by Alex
04:14
created

TAssociationEndType::setRole()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\TOperationsTrait;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TQualifiedNameTrait;
9
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait;
10
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TMultiplicityTrait;
11
12
/**
13
 * Class representing TAssociationEndType
14
 *
15
 *
16
 * XSD Type: TAssociationEnd
17
 */
18
class TAssociationEndType extends IsOK
19
{
20
    use IsOKToolboxTrait, TOperationsTrait, TQualifiedNameTrait, TSimpleIdentifierTrait, TMultiplicityTrait;
21
    /**
22
     * @property string $type
23
     */
24
    private $type = null;
25
26
    /**
27
     * @property string $role
28
     */
29
    private $role = null;
30
31
    /**
32
     * @property string $multiplicity
33
     */
34
    private $multiplicity = null;
35
36
    /**
37
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation
38
     */
39
    private $documentation = null;
40
41
    /**
42
     * Gets as type
43
     *
44
     * @return string
45
     */
46
    public function getType()
47
    {
48
        return $this->type;
49
    }
50
51
    /**
52
     * Sets a new type
53
     *
54
     * @param string $type
55
     * @return self
56
     */
57
    public function setType($type)
58
    {
59
        $this->type = $type;
60
        return $this;
61
    }
62
63
    /**
64
     * Gets as role
65
     *
66
     * @return string
67
     */
68
    public function getRole()
69
    {
70
        return $this->role;
71
    }
72
73
    /**
74
     * Sets a new role
75
     *
76
     * @param string $role
77
     * @return self
78
     */
79
    public function setRole($role)
80
    {
81
        $this->role = $role;
82
        return $this;
83
    }
84
85
    /**
86
     * Gets as multiplicity
87
     *
88
     * @return string
89
     */
90
    public function getMultiplicity()
91
    {
92
        return $this->multiplicity;
93
    }
94
95
    /**
96
     * Sets a new multiplicity
97
     *
98
     * @param string $multiplicity
99
     * @return self
100
     */
101
    public function setMultiplicity($multiplicity)
102
    {
103
        $this->multiplicity = $multiplicity;
104
        return $this;
105
    }
106
107
    /**
108
     * Gets as documentation
109
     *
110
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType
111
     */
112
    public function getDocumentation()
113
    {
114
        return $this->documentation;
115
    }
116
117
    /**
118
     * Sets a new documentation
119
     *
120
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation
121
     * @return self
122
     */
123
    public function setDocumentation(TDocumentationType $documentation)
124
    {
125
        $this->documentation = $documentation;
126
        return $this;
127
    }
128
129
    public function isOK(&$msg = null)
130
    {
131
        if (!$this->isTQualifiedNameValid($this->type)) {
132
            $msg = "Type must be a valid TQualifiedName";
133
            return false;
134
        }
135
        if (null != $this->role && !$this->isTSimpleIdentifierValid($this->role)) {
136
            $msg = "Role must be a valid TSimpleIdentifier";
137
            return false;
138
        }
139
        if (null != $this->multiplicity && !$this->isTMultiplicityValid($this->multiplicity)) {
140
            $msg = "Multiplicity must be a valid TMultiplicity";
141
            return false;
142
        }
143
        if (null != $this->isObjectNullOrOK($this->documentation, $msg)) {
144
            return false;
145
        }
146
147
        if (!$this->isTOperationsOK($msg)) {
148
            return false;
149
        }
150
        return true;
151
    }
152
}
153