Completed
Push — master ( c5c0e9...29e67b )
by David
14s
created

EnvVariable   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 62
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 5 1
A __construct() 0 4 1
A setType() 0 3 1
A getType() 0 3 1
A setValue() 0 3 1
A getValue() 0 3 1
1
<?php
2
3
namespace TheAentMachine\Service\Environment;
4
5
class EnvVariable implements \JsonSerializable
6
{
7
    /** @var string */
8
    private $value;
9
    /** @var string */
10
    private $type;
11
12
    /**
13
     * EnvironmentVariable constructor.
14
     * @param string $value
15
     * @param string $type
16
     */
17
    public function __construct(string $value, string $type)
18
    {
19
        $this->value = $value;
20
        $this->type = $type;
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    public function getValue(): string
27
    {
28
        return $this->value;
29
    }
30
31
    /**
32
     * @param string $value
33
     */
34
    public function setValue(string $value): void
35
    {
36
        $this->value = $value;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getType(): string
43
    {
44
        return $this->type;
45
    }
46
47
    /**
48
     * @param string $type
49
     */
50
    public function setType(string $type): void
51
    {
52
        $this->type = $type;
53
    }
54
55
    /**
56
     * Specify data which should be serialized to JSON
57
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
58
     * @return array data which can be serialized by <b>json_encode</b>,
59
     * which is a value of any type other than a resource.
60
     * @since 5.4.0
61
     */
62
    public function jsonSerialize(): array
63
    {
64
        return array(
65
            'value' => $this->value,
66
            'type' => $this->type
67
        );
68
    }
69
}
70