Completed
Push — master ( 949a11...75d1c6 )
by David
03:05 queued 10s
created

SharedEnvVariable::getContainerId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TheAentMachine\Service\Environment;
4
5
class SharedEnvVariable extends EnvVariable
6
{
7
    /**
8
     * @var null|string
9
     */
10
    private $containerId;
11
12
    public function __construct(string $value, string $type, ?string $comment, ?string $containerId)
13
    {
14
        parent::__construct($value, $type, $comment);
15
        $this->containerId = $containerId;
16
    }
17
18
    /**
19
     * @return null|string
20
     */
21
    public function getContainerId(): ?string
22
    {
23
        return $this->containerId;
24
    }
25
26
    /**
27
     * Specify data which should be serialized to JSON
28
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
29
     * @return array data which can be serialized by <b>json_encode</b>,
30
     * which is a value of any type other than a resource.
31
     * @since 5.4.0
32
     */
33
    public function jsonSerialize(): array
34
    {
35
        return array_filter([
36
            'value' => $this->getValue(),
37
            'type' => $this->getType(),
38
            'comment' => $this->getComment(),
39
            'containerId' => $this->containerId
40
        ]);
41
    }
42
}
43