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

ParametersAnonymousType   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 73
loc 73
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A addToParameter() 5 5 1
A issetParameter() 4 4 1
A unsetParameter() 4 4 1
A getParameter() 4 4 1
A setParameter() 5 5 1
A isOK() 8 8 1

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\edm\TAnonymousFunctionExpressionType;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionParameterType;
8
9
/**
10
 * Class representing ParametersAnonymousType
11
 */
12 View Code Duplication
class ParametersAnonymousType 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...
13
{
14
    use IsOKToolboxTrait;
15
    /**
16
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionParameterType[] $parameter
17
     */
18
    private $parameter = [];
19
20
    /**
21
     * Adds as parameter
22
     *
23
     * @return self
24
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionParameterType $parameter
25
     */
26
    public function addToParameter(TFunctionParameterType $parameter)
27
    {
28
        $this->parameter[] = $parameter;
29
        return $this;
30
    }
31
32
    /**
33
     * isset parameter
34
     *
35
     * @param scalar $index
36
     * @return boolean
37
     */
38
    public function issetParameter($index)
39
    {
40
        return isset($this->parameter[$index]);
41
    }
42
43
    /**
44
     * unset parameter
45
     *
46
     * @param scalar $index
47
     * @return void
48
     */
49
    public function unsetParameter($index)
50
    {
51
        unset($this->parameter[$index]);
52
    }
53
54
    /**
55
     * Gets as parameter
56
     *
57
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionParameterType[]
58
     */
59
    public function getParameter()
60
    {
61
        return $this->parameter;
62
    }
63
64
    /**
65
     * Sets a new parameter
66
     *
67
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionParameterType[] $parameter
68
     * @return self
69
     */
70
    public function setParameter(array $parameter)
71
    {
72
        $this->parameter = $parameter;
73
        return $this;
74
    }
75
    
76
    public function isOK(&$msg = null)
77
    {
78
        return !$this->isValidArrayOK(
79
            $this->parameter,
80
            '\AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionParameterType',
81
            $msg
82
        );
83
    }
84
}
85