Completed
Push — master ( a128d4...ff765d )
by Vladimir
10:36
created

Attachment::getMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Templates;
6
7
use Illuminate\Support\Collection;
8
9
class Attachment
10
{
11
    public const TYPE_FILE = 'file';
12
    public const TYPE_IMAGE = 'image';
13
    public const TYPE_AUDIO = 'audio';
14
    public const TYPE_VIDEO = 'video';
15
16
    private $type;
17
    private $path;
18
    private $parameters;
19
20 13
    public function __construct(string $type, string $path, array $parameters = [])
21
    {
22 13
        $this->type = $type;
23 13
        $this->path = $path;
24 13
        $this->parameters = collect($parameters);
25 13
    }
26
27 13
    public static function create(string $type, string $path, array $parameters = [])
28
    {
29 13
        return new static($type, $path, $parameters);
30
    }
31
32 12
    public function getType(): string
33
    {
34 12
        return $this->type;
35
    }
36
37
    public function setType(string $type): Attachment
38
    {
39
        $this->type = $type;
40
41
        return $this;
42
    }
43
44 4
    public function getPath(): string
45
    {
46 4
        return $this->path;
47
    }
48
49
    public function setPath(string $path): Attachment
50
    {
51
        $this->path = $path;
52
53
        return $this;
54
    }
55
56 4
    public function getParameters(): Collection
57
    {
58 4
        return $this->parameters;
59
    }
60
61
    public function setParameters(array $parameters): Attachment
62
    {
63
        $this->parameters = collect($parameters);
64
65
        return $this;
66
    }
67
68 5
    public static function possibleTypes(): array
69
    {
70
        return [
71 5
            static::TYPE_FILE,
72 5
            static::TYPE_IMAGE,
73 5
            static::TYPE_AUDIO,
74 5
            static::TYPE_VIDEO,
75
        ];
76
    }
77
}
78