| 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 $contents; |
||
| 19 | protected $guzzle; |
||
| 20 | |||
| 21 | 12 | public function __construct(string $type, string $path) |
|
| 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 |
|
| 43 | { |
||
| 44 | 4 | return $this->path; |
|
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Get all types. |
||
| 49 | * |
||
| 50 | * @return array |
||
| 51 | */ |
||
| 52 | 5 | public static function possibleTypes(): array |
|
| 61 | |||
| 62 | /** |
||
| 63 | * Get the instance as an array. |
||
| 64 | * |
||
| 65 | * @return array |
||
| 66 | */ |
||
| 67 | 4 | public function toArray(): array |
|
| 74 | } |
||
| 75 |