Passed
Push — master ( 143625...0aa694 )
by Alex
03:46
created

TParameterReferenceExpressionType   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 4 4 1
A setName() 5 5 1
A isOK() 8 8 2

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;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait;
8
9
/**
10
 * Class representing TParameterReferenceExpressionType
11
 *
12
 *
13
 * XSD Type: TParameterReferenceExpression
14
 */
15 View Code Duplication
class TParameterReferenceExpressionType 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...
16
{
17
    use IsOKToolboxTrait, TSimpleIdentifierTrait;
18
    /**
19
     * @property string $name
20
     */
21
    private $name = null;
22
23
    /**
24
     * Gets as name
25
     *
26
     * @return string
27
     */
28
    public function getName()
29
    {
30
        return $this->name;
31
    }
32
33
    /**
34
     * Sets a new name
35
     *
36
     * @param string $name
37
     * @return self
38
     */
39
    public function setName($name)
40
    {
41
        $this->name = $name;
42
        return $this;
43
    }
44
45
    public function isOK(&$msg = null)
46
    {
47
        if (!$this->isTSimpleIdentifierValid($this->name)) {
48
            $msg = "Name must be a valid TSimpleIdentifierValid";
49
            return false;
50
        }
51
        return true;
52
    }
53
}
54