Completed
Push — master ( d01340...7e7fa7 )
by Portey
07:36
created

Variable   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 73.33%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 6
c 4
b 0
f 1
lcom 1
cbo 0
dl 0
loc 51
ccs 11
cts 15
cp 0.7333
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setName() 0 4 1
A getValue() 0 8 2
A setValue() 0 4 1
A getName() 0 4 1
1
<?php
2
/**
3
 * Date: 23.11.15
4
 *
5
 * @author Portey Vasil <[email protected]>
6
 */
7
8
namespace Youshido\GraphQL\Parser\Value;
9
10
class Variable implements ValueInterface
11
{
12
13
    /** @var  string */
14
    private $name;
15
16
    private $value;
17
18 3
    public function __construct($name)
19
    {
20 3
        $this->name = $name;
21 3
    }
22
23
    /**
24
     * @return mixed
25
     *
26
     * @throws \Exception
27
     */
28 1
    public function getValue()
29
    {
30 1
        if (!$this->value) {
31
            throw new \Exception('Value not setted to variable');
32
        }
33
34 1
        return $this->value;
35
    }
36
37
    /**
38
     * @param mixed $value
39
     */
40 1
    public function setValue($value)
41
    {
42 1
        $this->value = $value;
43 1
    }
44
45
    /**
46
     * @return string
47
     */
48 1
    public function getName()
49
    {
50 1
        return $this->name;
51
    }
52
53
    /**
54
     * @param string $name
55
     */
56
    public function setName($name)
57
    {
58
        $this->name = $name;
59
    }
60
}