Completed
Push — master ( 328402...1cd18c )
by Julien
587:13 queued 584:54
created

CINewImageReplyPayload::__construct()   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 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TheAentMachine\Aent\Payload\CI;
4
5
use TheAentMachine\Aent\Payload\JsonPayloadInterface;
6
7
final class CINewImageReplyPayload implements JsonPayloadInterface
8
{
9
    /** @var string */
10
    private $imageName;
11
12
    /**
13
     * CINewImageReplyPayload constructor.
14
     * @param string $imageName
15
     */
16
    public function __construct(string $imageName)
17
    {
18
        $this->imageName = $imageName;
19
    }
20
21
    /**
22
     * @return array<string,string>
23
     */
24
    public function toArray(): array
25
    {
26
        return [
27
            'IMAGE_NAME' => $this->imageName,
28
        ];
29
    }
30
31
    /**
32
     * @param array<string,string> $assoc
33
     * @return self
34
     */
35
    public static function fromArray(array $assoc): self
36
    {
37
        $imageName = $assoc['IMAGE_NAME'];
38
        return new self($imageName);
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getImageName(): string
45
    {
46
        return $this->imageName;
47
    }
48
}
49