12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * @desc StorageService
- *
- * @author Tinywan(ShaoBo Wan)
- * @date 2022/3/7 20:03
- */
- declare(strict_types=1);
- namespace support;
- /**
- * @see Storage
- * @mixin Storage
- *
- * @method static array uploadFile(array $config = []) 上传文件
- * @method static array uploadBase64(string $base64, string $extension = 'png') 上传Base64文件
- * @method static array uploadServerFile(string $file_path) 上传服务端文件
- */
- class Storage extends \Tinywan\Storage\Storage
- {
- /**
- * @desc 存储磁盘
- * @param string|null $name
- * @param bool $_is_file_upload
- * @return mixed
- * @author Tinywan(ShaoBo Wan)
- */
- public static function disk(string $name = null, bool $_is_file_upload = true, array $arguments = [])
- {
- $storage = $name ?? self::getDefaultStorage();
- $config = self::getConfig($storage);
- return new $config['adapter'](array_merge(
- $config, ['_is_file_upload' => $_is_file_upload], $arguments[0]
- ));
- }
- /**
- * @param $name
- * @param $arguments
- * @return mixed
- * @author Tinywan(ShaoBo Wan)
- */
- public static function __callStatic($name, $arguments)
- {
- return static::disk(null, true, $arguments)->{$name}(...$arguments);
- }
- }
|