Completed
Push — master ( 44dea0...59b9fb )
by Vladimir
02:47
created

Attachment::setMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Templates;
6
7
class Attachment
8
{
9
    public const TYPE_FILE = 'file';
10
    public const TYPE_IMAGE = 'image';
11
    public const TYPE_AUDIO = 'audio';
12
    public const TYPE_VIDEO = 'video';
13
14
    private $type;
15
    private $path;
16
    private $metadata;
17
18
    /**
19
     * Get type.
20
     *
21
     * @return string
22
     */
23 12
    public function getType(): string
24
    {
25 12
        return $this->type;
26
    }
27
28
    /**
29
     * Set type.
30
     *
31
     * @param string $type
32
     *
33
     * @return Attachment
34
     */
35 12
    public function setType(string $type): Attachment
36
    {
37 12
        $this->type = $type;
38
39 12
        return $this;
40
    }
41
42
    /**
43
     * Get path.
44
     *
45
     * @return string
46
     */
47 4
    public function getPath(): string
48
    {
49 4
        return $this->path;
50
    }
51
52
    /**
53
     * Set path.
54
     *
55
     * @param string $path
56
     *
57
     * @return Attachment
58
     */
59 4
    public function setPath(string $path): Attachment
60
    {
61 4
        $this->path = $path;
62
63 4
        return $this;
64
    }
65
66
    /**
67
     * Get metadata.
68
     *
69
     * @return array
70
     */
71 4
    public function getMetadata(): array
72
    {
73 4
        return $this->metadata;
74
    }
75
76
    /**
77
     * Set metadata.
78
     *
79
     * @param array $metadata
80
     *
81
     * @return Attachment
82
     */
83 4
    public function setMetadata(array $metadata): Attachment
84
    {
85 4
        $this->metadata = $metadata;
86
87 4
        return $this;
88
    }
89
90
    /**
91
     * Get all types.
92
     *
93
     * @return array
94
     */
95 5
    public static function possibleTypes(): array
96
    {
97
        return [
98 5
            static::TYPE_FILE,
99 5
            static::TYPE_IMAGE,
100 5
            static::TYPE_AUDIO,
101 5
            static::TYPE_VIDEO,
102
        ];
103
    }
104
}
105