Passed
Push — master ( 418524...2ac80a )
by Alex
03:43
created

TConnectionType   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 79
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 79
loc 79
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A addToDesignerInfoPropertySet() 5 5 1
A issetDesignerInfoPropertySet() 4 4 1
A unsetDesignerInfoPropertySet() 4 4 1
A getDesignerInfoPropertySet() 4 4 1
A setDesignerInfoPropertySet() 5 5 1
A isOK() 14 14 3

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\edmx;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
7
/**
8
 * Class representing TConnectionType
9
 *
10
 *
11
 * XSD Type: TConnection
12
 */
13 View Code Duplication
class TConnectionType extends IsOK
0 ignored issues
show
Duplication introduced by
This class 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...
14
{
15
16
    /**
17
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDesignerPropertyType[] $designerInfoPropertySet
18
     */
19
    private $designerInfoPropertySet = [];
20
21
    /**
22
     * Adds as designerProperty
23
     *
24
     * @return self
25
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDesignerPropertyType $designerProperty
26
     */
27
    public function addToDesignerInfoPropertySet(TDesignerPropertyType $designerProperty)
28
    {
29
        $this->designerInfoPropertySet[] = $designerProperty;
30
        return $this;
31
    }
32
33
    /**
34
     * isset designerInfoPropertySet
35
     *
36
     * @param scalar $index
37
     * @return boolean
38
     */
39
    public function issetDesignerInfoPropertySet($index)
40
    {
41
        return isset($this->designerInfoPropertySet[$index]);
42
    }
43
44
    /**
45
     * unset designerInfoPropertySet
46
     *
47
     * @param scalar $index
48
     * @return void
49
     */
50
    public function unsetDesignerInfoPropertySet($index)
51
    {
52
        unset($this->designerInfoPropertySet[$index]);
53
    }
54
55
    /**
56
     * Gets as designerInfoPropertySet
57
     *
58
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDesignerPropertyType[]
59
     */
60
    public function getDesignerInfoPropertySet()
61
    {
62
        return $this->designerInfoPropertySet;
63
    }
64
65
    /**
66
     * Sets a new designerInfoPropertySet
67
     *
68
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDesignerPropertyType[] $designerInfoPropertySet
69
     * @return self
70
     */
71
    public function setDesignerInfoPropertySet(array $designerInfoPropertySet)
72
    {
73
        $this->designerInfoPropertySet = $designerInfoPropertySet;
74
        return $this;
75
    }
76
77
    public function isOK(&$msg = null)
78
    {
79
        if (!$this->isValidArray(
80
            $this->designerInfoPropertySet,
81
            '\AlgoWeb\ODataMetadata\MetadataV3\edmx\TDesignerPropertyType'
82
        )) {
83
            $msg = "Designer info property set not a valid array";
84
            return false;
85
        }
86
        if (!$this->isChildArrayOK($this->designerInfoPropertySet, $msg)) {
87
            return false;
88
        }
89
        return true;
90
    }
91
}
92