Completed
Push — master ( 5bf303...8cd23b )
by Portey
03:14
created

Variable   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 8
c 5
b 0
f 1
lcom 1
cbo 0
dl 0
loc 73
ccs 14
cts 21
cp 0.6667
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getValue() 0 8 2
A setValue() 0 4 1
A getName() 0 4 1
A setName() 0 4 1
A getType() 0 4 1
A setType() 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
    /** @var  mixed */
17
    private $value;
18
19
    /** @var string */
20
    private $type;
21
22 3
    public function __construct($name, $type)
23
    {
24 3
        $this->name = $name;
25 3
        $this->type = $type;
26 3
    }
27
28
    /**
29
     * @return mixed
30
     *
31
     * @throws \Exception
32
     */
33 1
    public function getValue()
34
    {
35 1
        if (!$this->value) {
36
            throw new \Exception('Value not setted to variable');
37
        }
38
39 1
        return $this->value;
40
    }
41
42
    /**
43
     * @param mixed $value
44
     */
45 1
    public function setValue($value)
46
    {
47 1
        $this->value = $value;
48 1
    }
49
50
    /**
51
     * @return string
52
     */
53 2
    public function getName()
54
    {
55 2
        return $this->name;
56
    }
57
58
    /**
59
     * @param string $name
60
     */
61
    public function setName($name)
62
    {
63
        $this->name = $name;
64
    }
65
66
    /**
67
     * @return string
68
     */
69 2
    public function getType()
70
    {
71 2
        return $this->type;
72
    }
73
74
    /**
75
     * @param string $type
76
     */
77
    public function setType($type)
78
    {
79
        $this->type = $type;
80
    }
81
82
}