Passed
Push — master ( bc609e...49bb39 )
by Alex
03:56
created

TEntityTypeModificationFunctionType   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 163
Duplicated Lines 11.04 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 18
lcom 1
cbo 4
dl 18
loc 163
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A getFunctionName() 0 4 1
A setFunctionName() 0 5 1
A getRowsAffectedParameter() 0 4 1
A setRowsAffectedParameter() 0 5 1
A getScalarProperty() 0 4 1
A setScalarProperty() 0 5 1
A getAssociationEnd() 0 4 1
A setAssociationEnd() 0 5 1
A getComplexProperty() 0 4 1
A setComplexProperty() 0 5 1
B isOK() 18 18 8

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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