Passed
Push — master ( 46bec3...dbfdbf )
by Alex
04:19
created

TAssociationEndType::setOnDelete()   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\ssdl;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TMultiplicityTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TQualifiedNameTrait;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TSimpleIdentifierTrait;
9
10
/**
11
 * Class representing TAssociationEndType
12
 *
13
 *
14
 * XSD Type: TAssociationEnd
15
 */
16
class TAssociationEndType extends IsOK
17
{
18
    use TSimpleIdentifierTrait, TQualifiedNameTrait, TMultiplicityTrait, TOperations;
19
    /**
20
     * @property string $type
21
     */
22
    private $type = null;
23
24
    /**
25
     * @property string $role
26
     */
27
    private $role = null;
28
29
    /**
30
     * @property string $multiplicity
31
     */
32
    private $multiplicity = null;
33
34
    /**
35
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation
36
     */
37
    private $documentation = null;
38
39
    /**
40
     * Gets as type
41
     *
42
     * @return string
43
     */
44
    public function getType()
45
    {
46
        return $this->type;
47
    }
48
49
    /**
50
     * Sets a new type
51
     *
52
     * @param string $type
53
     * @return self
54
     */
55
    public function setType($type)
56
    {
57
        $this->type = $type;
58
        return $this;
59
    }
60
61
    /**
62
     * Gets as role
63
     *
64
     * @return string
65
     */
66
    public function getRole()
67
    {
68
        return $this->role;
69
    }
70
71
    /**
72
     * Sets a new role
73
     *
74
     * @param string $role
75
     * @return self
76
     */
77
    public function setRole($role)
78
    {
79
        $this->role = $role;
80
        return $this;
81
    }
82
83
    /**
84
     * Gets as multiplicity
85
     *
86
     * @return string
87
     */
88
    public function getMultiplicity()
89
    {
90
        return $this->multiplicity;
91
    }
92
93
    /**
94
     * Sets a new multiplicity
95
     *
96
     * @param string $multiplicity
97
     * @return self
98
     */
99
    public function setMultiplicity($multiplicity)
100
    {
101
        $this->multiplicity = $multiplicity;
102
        return $this;
103
    }
104
105
    /**
106
     * Gets as documentation
107
     *
108
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType
109
     */
110
    public function getDocumentation()
111
    {
112
        return $this->documentation;
113
    }
114
115
    /**
116
     * Sets a new documentation
117
     *
118
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation
119
     * @return self
120
     */
121
    public function setDocumentation(TDocumentationType $documentation)
122
    {
123
        $this->documentation = $documentation;
124
        return $this;
125
    }
126
    
127
    public function isOK(&$msg = null)
128
    {
129
        if (!$this->isStringNotNullOrEmpty($this->type)) {
130
            $msg = "Type cannot be null or empty";
131
            return false;
132
        }
133
        if (!$this->isStringNotNullOrEmpty($this->multiplicity)) {
134
            $msg = "Multiplicity cannot be null or empty";
135
            return false;
136
        }
137 View Code Duplication
        if (null != $this->role && !$this->isStringNotNullOrEmpty($this->role)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

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.

Loading history...
138
            $msg = "Role cannot be empty";
139
            return false;
140
        }
141
        if (null != $this->role && !$this->isTSimpleIdentifierValid($this->role)) {
142
            $msg = "Role must be a valid TSimpleIdentifier";
143
            return false;
144
        }
145
        if (!$this->isTMultiplicityValid($this->multiplicity)) {
146
            $msg = "Multiplicity must be a valid TMultiplicity";
147
            return false;
148
        }
149
        if (!$this->isOperationsGroupOK($msg)) {
150
            return false;
151
        }
152
153
        return true;
154
    }
155
}
156