TmpfsVolume   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A jsonSerialize() 0 8 1
1
<?php
2
3
namespace TheAentMachine\Service\Volume;
4
5
use TheAentMachine\Service\Enum\VolumeTypeEnum;
6
7
class TmpfsVolume extends Volume
8
{
9
    public function getType(): string
10
    {
11
        return VolumeTypeEnum::TMPFS_VOLUME;
12
    }
13
14
    /**
15
     * Specify data which should be serialized to JSON
16
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
17
     * @return array data which can be serialized by <b>json_encode</b>,
18
     * which is a value of any type other than a resource.
19
     * @since 5.4.0
20
     */
21
    public function jsonSerialize(): array
22
    {
23
        return array_filter([
24
            'type' => $this->getType(),
25
            'source' => $this->source,
26
            'comment' => $this->comment,
27
        ], function ($v) {
28
            return null !== $v;
29
        });
30
    }
31
}
32