TmpfsVolume::getType()   A
last analyzed

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\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