1 | <?php |
||
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 = []) |
|
26 | |||
27 | 13 | public static function make(string $type, string $path, array $parameters = []) |
|
28 | { |
||
29 | 13 | return new static($type, $path, $parameters); |
|
30 | } |
||
31 | |||
32 | public static function file(string $path, array $parameters = []) |
||
36 | |||
37 | public static function image(string $path, array $parameters = []) |
||
41 | |||
42 | public static function audio(string $path, array $parameters = []) |
||
46 | |||
47 | public static function video(string $path, array $parameters = []) |
||
51 | |||
52 | 12 | public function getType(): string |
|
56 | |||
57 | public function setType(string $type): Attachment |
||
63 | |||
64 | 4 | public function getPath(): string |
|
68 | |||
69 | public function setPath(string $path): Attachment |
||
75 | |||
76 | 4 | public function getParameters(): Collection |
|
80 | |||
81 | public function setParameters(array $parameters): Attachment |
||
87 | |||
88 | 5 | public static function possibleTypes(): array |
|
97 | } |
||
98 |