From 187aaa0c786120b70c8ed1289837cb80d5b27775 Mon Sep 17 00:00:00 2001 From: Eric Lagarda Date: Wed, 24 Jul 2019 10:15:28 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Events/FileRemoved.php | 4 ++-- src/Events/FileUploaded.php | 4 ++-- src/Events/FolderRemoved.php | 4 ++-- src/Events/FolderUploaded.php | 4 ++-- src/FilemanagerServiceProvider.php | 4 ++-- src/Http/Controllers/FilemanagerToolController.php | 2 +- src/Http/Services/FileManagerService.php | 14 +++++++------- src/Http/Services/GetFiles.php | 14 +++++++------- src/Http/Services/NormalizeFile.php | 14 +++++++------- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Events/FileRemoved.php b/src/Events/FileRemoved.php index beb0338..1e7647d 100644 --- a/src/Events/FileRemoved.php +++ b/src/Events/FileRemoved.php @@ -2,8 +2,8 @@ namespace Infinety\Filemanager\Events; -use Illuminate\Filesystem\FilesystemAdapter; use Illuminate\Queue\SerializesModels; +use Illuminate\Filesystem\FilesystemAdapter; class FileRemoved { @@ -24,7 +24,7 @@ class FileRemoved * * @return void */ - public function __construct(FilesystemAdapter $storage, String $filePath) + public function __construct(FilesystemAdapter $storage, string $filePath) { $this->storage = $storage; $this->filePath = $filePath; diff --git a/src/Events/FileUploaded.php b/src/Events/FileUploaded.php index 03665ce..d2384d6 100644 --- a/src/Events/FileUploaded.php +++ b/src/Events/FileUploaded.php @@ -2,8 +2,8 @@ namespace Infinety\Filemanager\Events; -use Illuminate\Filesystem\FilesystemAdapter; use Illuminate\Queue\SerializesModels; +use Illuminate\Filesystem\FilesystemAdapter; class FileUploaded { @@ -24,7 +24,7 @@ class FileUploaded * * @return void */ - public function __construct(FilesystemAdapter $storage, String $filePath) + public function __construct(FilesystemAdapter $storage, string $filePath) { $this->storage = $storage; $this->filePath = $filePath; diff --git a/src/Events/FolderRemoved.php b/src/Events/FolderRemoved.php index 7eedde0..c628099 100644 --- a/src/Events/FolderRemoved.php +++ b/src/Events/FolderRemoved.php @@ -2,8 +2,8 @@ namespace Infinety\Filemanager\Events; -use Illuminate\Filesystem\FilesystemAdapter; use Illuminate\Queue\SerializesModels; +use Illuminate\Filesystem\FilesystemAdapter; class FolderRemoved { @@ -24,7 +24,7 @@ class FolderRemoved * * @return void */ - public function __construct(FilesystemAdapter $storage, String $folderPath) + public function __construct(FilesystemAdapter $storage, string $folderPath) { $this->storage = $storage; $this->folderPath = $folderPath; diff --git a/src/Events/FolderUploaded.php b/src/Events/FolderUploaded.php index 6e5c398..f65b78a 100644 --- a/src/Events/FolderUploaded.php +++ b/src/Events/FolderUploaded.php @@ -2,8 +2,8 @@ namespace Infinety\Filemanager\Events; -use Illuminate\Filesystem\FilesystemAdapter; use Illuminate\Queue\SerializesModels; +use Illuminate\Filesystem\FilesystemAdapter; class FolderUploaded { @@ -24,7 +24,7 @@ class FolderUploaded * * @return void */ - public function __construct(FilesystemAdapter $storage, String $folderPath) + public function __construct(FilesystemAdapter $storage, string $folderPath) { $this->storage = $storage; $this->folderPath = $folderPath; diff --git a/src/FilemanagerServiceProvider.php b/src/FilemanagerServiceProvider.php index 5d34963..efd63c3 100755 --- a/src/FilemanagerServiceProvider.php +++ b/src/FilemanagerServiceProvider.php @@ -2,11 +2,11 @@ namespace Infinety\Filemanager; +use Laravel\Nova\Nova; +use Laravel\Nova\Events\ServingNova; use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; use Infinety\Filemanager\Http\Middleware\Authorize; -use Laravel\Nova\Events\ServingNova; -use Laravel\Nova\Nova; class FilemanagerServiceProvider extends ServiceProvider { diff --git a/src/Http/Controllers/FilemanagerToolController.php b/src/Http/Controllers/FilemanagerToolController.php index 5e6cf37..b1f65b3 100755 --- a/src/Http/Controllers/FilemanagerToolController.php +++ b/src/Http/Controllers/FilemanagerToolController.php @@ -4,8 +4,8 @@ use Illuminate\Http\Request; use Illuminate\Routing\Controller; -use Infinety\Filemanager\Http\Services\FileManagerService; use Laravel\Nova\Http\Requests\NovaRequest; +use Infinety\Filemanager\Http\Services\FileManagerService; class FilemanagerToolController extends Controller { diff --git a/src/Http/Services/FileManagerService.php b/src/Http/Services/FileManagerService.php index 83ac09e..95711dc 100644 --- a/src/Http/Services/FileManagerService.php +++ b/src/Http/Services/FileManagerService.php @@ -2,15 +2,15 @@ namespace Infinety\Filemanager\Http\Services; -use Illuminate\Contracts\Bus\Dispatcher; use Illuminate\Http\Request; +use InvalidArgumentException; use Illuminate\Support\Facades\Storage; +use Illuminate\Contracts\Bus\Dispatcher; use Infinety\Filemanager\Events\FileRemoved; use Infinety\Filemanager\Events\FileUploaded; use Infinety\Filemanager\Events\FolderRemoved; use Infinety\Filemanager\Events\FolderUploaded; use Infinety\Filemanager\Exceptions\InvalidConfig; -use InvalidArgumentException; class FileManagerService { @@ -86,7 +86,7 @@ public function ajaxGetFilesAndFolders(Request $request, $filter = false) { $folder = $this->cleanSlashes($request->get('folder')); - if (!$this->folderExists($folder)) { + if (! $this->folderExists($folder)) { $folder = '/'; } @@ -98,7 +98,7 @@ public function ajaxGetFilesAndFolders(Request $request, $filter = false) $this->setRelativePath($folder); $order = $request->get('sort'); - if (!$order) { + if (! $order) { $order = config('filemanager.order', 'mime'); } @@ -190,7 +190,7 @@ public function uploadFile($file, $currentFolder, $visibility, $uploadingFolder if ($this->storage->putFileAs($currentFolder, $file, $fileName)) { $this->setVisibility($currentFolder, $fileName, $visibility); - if (!$uploadingFolder) { + if (! $uploadingFolder) { $this->checkJobs($this->storage, $currentFolder.$fileName); event(new FileUploaded($this->storage, $currentFolder.$fileName)); } @@ -229,7 +229,7 @@ public function getFileInfo($file) */ public function getFileInfoAsArray($file) { - if (!$this->storage->exists($file)) { + if (! $this->storage->exists($file)) { return []; } @@ -299,7 +299,7 @@ public function moveFile($oldPath, $newPath) } /** - * Folder uploaded event + * Folder uploaded event. * * @param string $path * diff --git a/src/Http/Services/GetFiles.php b/src/Http/Services/GetFiles.php index c639678..aee6ae8 100644 --- a/src/Http/Services/GetFiles.php +++ b/src/Http/Services/GetFiles.php @@ -60,7 +60,7 @@ public function getFiles($folder, $order, $filter = false) */ public function getFileData($file, $id) { - if (!$this->isDot($file) && !$this->exceptExtensions->contains($file['extension']) && !$this->exceptFolders->contains($file['basename']) && !$this->exceptFiles->contains($file['basename']) && $this->accept($file)) { + if (! $this->isDot($file) && ! $this->exceptExtensions->contains($file['extension']) && ! $this->exceptFolders->contains($file['basename']) && ! $this->exceptFiles->contains($file['basename']) && $this->accept($file)) { $fileInfo = [ 'id' => $id, 'name' => trim($file['basename']), @@ -82,14 +82,14 @@ public function getFileData($file, $id) } if ($fileInfo['mime'] == 'image') { - list($width, $height) = $this->getImageDimesions($file); - if (!$width == false) { + [$width, $height] = $this->getImageDimesions($file); + if (! $width == false) { $fileInfo['dimensions'] = $width.'x'.$height; } } if ($fileInfo['type'] == 'dir') { - if (!$this->checkShouldHideFolder($fileInfo['path'])) { + if (! $this->checkShouldHideFolder($fileInfo['path'])) { return false; } } @@ -386,10 +386,10 @@ public function getThumbFile($file) public function normalizeFiles($files) { foreach ($files as $key => $file) { - if (!isset($file['extension'])) { + if (! isset($file['extension'])) { $files[$key]['extension'] = null; } - if (!isset($file['size'])) { + if (! isset($file['size'])) { // $size = $this->storage->getSize($file['path']); $files[$key]['size'] = null; } @@ -504,7 +504,7 @@ public function modificationDate($time) } /** - * Hide folders with .hide file + * Hide folders with .hide file. * @param $oath */ private function checkShouldHideFolder($path) diff --git a/src/Http/Services/NormalizeFile.php b/src/Http/Services/NormalizeFile.php index 582fa52..cbc7614 100644 --- a/src/Http/Services/NormalizeFile.php +++ b/src/Http/Services/NormalizeFile.php @@ -2,12 +2,12 @@ namespace Infinety\Filemanager\Http\Services; -use Carbon\Carbon; -use Illuminate\Filesystem\FilesystemAdapter; -use Illuminate\Support\Collection; use RarArchive; -use SplFileInfo; use ZipArchive; +use SplFileInfo; +use Carbon\Carbon; +use Illuminate\Support\Collection; +use Illuminate\Filesystem\FilesystemAdapter; class NormalizeFile { @@ -31,7 +31,7 @@ class NormalizeFile /** * @param string $path */ - public function __construct(FilesystemAdapter $storage, String $path, String $storagePath) + public function __construct(FilesystemAdapter $storage, string $path, string $storagePath) { $this->storage = $storage; $this->file = new SplFileInfo($path); @@ -162,9 +162,9 @@ private function getDimensions($mime) } if (str_contains($mime, 'image')) { - list($width, $height) = getimagesize($this->storage->path($this->storagePath)); + [$width, $height] = getimagesize($this->storage->path($this->storagePath)); - if (!empty($width) && !empty($height)) { + if (! empty($width) && ! empty($height)) { return $width.'x'.$height; } }