1 | <?php |
||
9 | class Attachment implements Arrayable |
||
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 | protected $type; |
||
17 | protected $path; |
||
18 | protected $metadata; |
||
19 | |||
20 | 12 | public function __construct(string $type, string $path, array $metadata = []) |
|
26 | |||
27 | /** |
||
28 | * Get attachment type. |
||
29 | * |
||
30 | * @return string |
||
31 | */ |
||
32 | 12 | public function getType(): string |
|
36 | |||
37 | /** |
||
38 | * Get path to the attachment. |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | 4 | public function getPath(): string |
|
46 | |||
47 | /** |
||
48 | * Get attachment metadata. |
||
49 | * |
||
50 | * @return array |
||
51 | */ |
||
52 | 4 | public function getMetadata(): array |
|
56 | |||
57 | /** |
||
58 | * Get all types. |
||
59 | * |
||
60 | * @return array |
||
61 | */ |
||
62 | 5 | public static function possibleTypes(): array |
|
71 | |||
72 | /** |
||
73 | * Get the instance as an array. |
||
74 | * |
||
75 | * @return array |
||
76 | */ |
||
77 | 4 | public function toArray(): array |
|
84 | } |
||
85 |