1 | <?php |
||
14 | class Attachment implements AttachmentContract, Arrayable |
||
15 | { |
||
16 | public const TYPE_FILE = 'file'; |
||
17 | public const TYPE_IMAGE = 'image'; |
||
18 | public const TYPE_AUDIO = 'audio'; |
||
19 | public const TYPE_VIDEO = 'video'; |
||
20 | |||
21 | protected $type; |
||
22 | protected $path; |
||
23 | protected $contents; |
||
24 | protected $guzzle; |
||
25 | |||
26 | 9 | public function __construct(string $type, string $path, Client $guzzle = null) |
|
32 | |||
33 | /** |
||
34 | * Get attachment type. |
||
35 | * |
||
36 | * @return string |
||
37 | */ |
||
38 | 8 | public function getType(): string |
|
42 | |||
43 | /** |
||
44 | * Get path to the attachment. |
||
45 | * |
||
46 | * @return string |
||
47 | */ |
||
48 | public function getPath(): string |
||
52 | |||
53 | /** |
||
54 | * Get attachment contents. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getContents(): string |
||
66 | |||
67 | /** |
||
68 | * Get attachment as a file. |
||
69 | * |
||
70 | * @return File |
||
71 | */ |
||
72 | public function getFile(): File |
||
80 | |||
81 | /** |
||
82 | * Get all types. |
||
83 | * |
||
84 | * @return array |
||
85 | */ |
||
86 | 4 | public static function possibleTypes(): array |
|
95 | |||
96 | /** |
||
97 | * Get the instance as an array. |
||
98 | * |
||
99 | * @return array |
||
100 | */ |
||
101 | public function toArray(): array |
||
108 | } |
||
109 |