VariableReference   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 0
cbo 1
dl 48
loc 48
ccs 14
cts 14
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 7 1
A getVariable() 4 4 1
A getValue() 4 4 1
A setValue() 4 4 1
A getName() 4 4 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
 * Date: 10/24/16
4
 *
5
 * @author Portey Vasil <[email protected]>
6
 */
7
8
namespace Youshido\GraphQL\Parser\Ast\ArgumentValue;
9
10
11
use Youshido\GraphQL\Parser\Ast\AbstractAst;
12
use Youshido\GraphQL\Parser\Ast\Interfaces\ValueInterface;
13
use Youshido\GraphQL\Parser\Location;
14
15 View Code Duplication
class VariableReference extends AbstractAst implements ValueInterface
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
18
    /** @var  string */
19
    private $name;
20
21
    /** @var  Variable */
22
    private $variable;
23
24
    /** @var  mixed */
25
    private $value;
26
27
    /**
28
     * @param string        $name
29
     * @param Variable|null $variable
30
     * @param Location      $location
31
     */
32 12
    public function __construct($name, Variable $variable = null, Location $location)
33
    {
34 12
        parent::__construct($location);
35
36 12
        $this->name     = $name;
37 12
        $this->variable = $variable;
38 12
    }
39
40 11
    public function getVariable()
41
    {
42 11
        return $this->variable;
43
    }
44
45 1
    public function getValue()
46
    {
47 1
        return $this->value;
48
    }
49
50 9
    public function setValue($value)
51
    {
52 9
        $this->value = $value;
53 9
    }
54
55
    /**
56
     * @return string
57
     */
58 10
    public function getName()
59
    {
60 10
        return $this->name;
61
    }
62
}
63