Completed
Push — master ( b8b70e...552805 )
by Portey
03:44
created

Variable::setName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
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
    public function __construct($name)
19
    {
20
        $this->name = $name;
21
    }
22
23
    /**
24
     * @return mixed
25
     *
26
     * @throws \Exception
27
     */
28
    public function getValue()
29
    {
30
        if (!$this->value) {
31
            throw new \Exception('Value not setted to variable');
32
        }
33
34
        return $this->value;
35
    }
36
37
    /**
38
     * @param mixed $value
39
     */
40
    public function setValue($value)
41
    {
42
        $this->value = $value;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getName()
49
    {
50
        return $this->name;
51
    }
52
53
    /**
54
     * @param string $name
55
     */
56
    public function setName($name)
57
    {
58
        $this->name = $name;
59
    }
60
}