Skip to content

Commit

Permalink
feature: downgrade php to 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
krissss committed Sep 18, 2022
1 parent 558dd0c commit 98c8d85
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 41 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"description": "Webman plugin webman-tech/laravel-filesystem",
"require": {
"php": ">=7.4"
"php": ">=7.2"
},
"require-dev": {
"iidestiny/flysystem-oss": "~2",
Expand Down
5 changes: 4 additions & 1 deletion src/FilesystemManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class FilesystemManager extends LaravelFilesystemManager
{
use ChangeAppUse;

protected array $filesystemConfig = [];
/**
* @var array
*/
protected $filesystemConfig = [];

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Install
* @var array
*/
protected static $pathRelation = array (
'copy/config/plugin/kriss/webman-filesystem' => 'config/plugin/kriss/webman-filesystem',
'copy/config/plugin/webman-tech/laravel-filesystem' => 'config/plugin/webman-tech/laravel-filesystem',
'copy/storage' => 'storage',
);

Expand Down
38 changes: 0 additions & 38 deletions src/Traits/ChangeHttpUse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

namespace WebmanTech\LaravelFilesystem\Traits;

use Illuminate\Support\Str;
use WebmanTech\LaravelFilesystem\Http\UploadedFile;
use Webman\File;
use Webman\Http\UploadFile;

/**
* 替换 Illuminate\Http 相关的
*/
Expand Down Expand Up @@ -43,37 +38,4 @@ public function response($path, $name = null, array $headers = [], $disposition
$content = ob_get_clean();
return $response->withBody($content);
}

/**
* @inheritDoc
* @param UploadFile|File|resource|string $contents
*/
public function put($path, $contents, $options = [])
{
$options = is_string($options)
? ['visibility' => $options]
: (array) $options;

if ($contents instanceof File) {
return $this->putFile($path, $contents, $options);
}

return parent::put($path, $contents, $options);
}

/**
* @inheritDoc
* @param UploadedFile|UploadFile|File|string $file
*/
public function putFile($path, $file, $options = [])
{
$file = is_string($file) ? new File($file) : $file;

$hashName = Str::random(40);
if ($extension = $file->getExtension()) {
$hashName .= '.' . $extension;
}

return $this->putFileAs($path, $file, $hashName, $options);
}
}

0 comments on commit 98c8d85

Please sign in to comment.