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

Variable::getValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 8
ccs 3
cts 4
cp 0.75
rs 9.4286
cc 2
eloc 4
nc 2
nop 0
crap 2.0625
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
}