| 1 | <?php |
||
| 12 | class Attachment implements Arrayable |
||
| 13 | { |
||
| 14 | public const TYPE_FILE = 'file'; |
||
| 15 | public const TYPE_IMAGE = 'image'; |
||
| 16 | public const TYPE_AUDIO = 'audio'; |
||
| 17 | public const TYPE_VIDEO = 'video'; |
||
| 18 | |||
| 19 | protected $type; |
||
| 20 | protected $path; |
||
| 21 | protected $contents; |
||
| 22 | protected $guzzle; |
||
| 23 | |||
| 24 | 8 | public function __construct(string $type, string $path, Client $guzzle = null) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * Get attachment type. |
||
| 33 | * |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | 8 | public function getType(): string |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Get path to the attachment. |
||
| 43 | * |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | public function getPath(): string |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Get attachment contents. |
||
| 53 | * |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | public function getContents(): string |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Get attachment as a file. |
||
| 67 | * |
||
| 68 | * @return File |
||
| 69 | */ |
||
| 70 | public function getFile(): File |
||
| 78 | |||
| 79 | /** |
||
| 80 | * Get all types. |
||
| 81 | * |
||
| 82 | * @return array |
||
| 83 | */ |
||
| 84 | 4 | public static function possibleTypes(): array |
|
| 93 | |||
| 94 | /** |
||
| 95 | * Get the instance as an array. |
||
| 96 | * |
||
| 97 | * @return array |
||
| 98 | */ |
||
| 99 | public function toArray(): array |
||
| 106 | } |
||
| 107 |