diff --git a/app/Exceptions/LocalProxyFileCanNotByDeleted.php b/app/Exceptions/LocalProxyFileCanNotByDeleted.php index 089a368..e3ec327 100644 --- a/app/Exceptions/LocalProxyFileCanNotByDeleted.php +++ b/app/Exceptions/LocalProxyFileCanNotByDeleted.php @@ -8,4 +8,4 @@ public static function throwException(): self { return new static('Local proxy file can not be deleted.'); } -} \ No newline at end of file +} diff --git a/app/Jobs/UpdateLocalFile.php b/app/Jobs/UpdateLocalFile.php index 2920ee5..37f3219 100644 --- a/app/Jobs/UpdateLocalFile.php +++ b/app/Jobs/UpdateLocalFile.php @@ -51,7 +51,7 @@ public function handle() /** @var LocalFile|RemoteFile $currentFile */ $currentFile = $this->proxyFile->file; - if (!$filesystem->delete($currentFile->getLocalStoragePath())) { + if (! $filesystem->delete($currentFile->getLocalStoragePath())) { throw LocalProxyFileCanNotByDeleted::throwException(); } $currentFile->forceDelete(); @@ -74,7 +74,7 @@ public function handle() 'path' => uniqid('', true), ]); - if (!$filesystem->exists('local')) { + if (! $filesystem->exists('local')) { $filesystem->makeDirectory('local'); } diff --git a/app/Jobs/UpdateRemoteFile.php b/app/Jobs/UpdateRemoteFile.php index fee75b6..3af1556 100644 --- a/app/Jobs/UpdateRemoteFile.php +++ b/app/Jobs/UpdateRemoteFile.php @@ -68,7 +68,7 @@ public function handle() /** @var LocalFile|RemoteFile $currentFile */ $currentFile = $this->proxyFile->file; - if (!$this->getFilesystem()->delete($currentFile->getLocalStoragePath())) { + if (! $this->getFilesystem()->delete($currentFile->getLocalStoragePath())) { throw LocalProxyFileCanNotByDeleted::throwException(); } $currentFile->forceDelete(); @@ -78,7 +78,7 @@ public function handle() try { \DB::beginTransaction(); - $content = (string)$response->getBody(); + $content = (string) $response->getBody(); $filename = basename($this->url); $parts = explode('.', $filename); @@ -132,7 +132,7 @@ private function cacheRemoteFileLocally(RemoteFile $remoteFile, string $content) } /** - * sets up filesystem + * sets up filesystem. * * @return Filesystem|\Illuminate\Filesystem\FilesystemAdapter */ @@ -140,9 +140,10 @@ private function getFilesystem() { /** @var Filesystem|\Illuminate\Filesystem\FilesystemAdapter $filesystem */ $filesystem = app(Filesystem::class); - if (!$filesystem->exists('remote')) { + if (! $filesystem->exists('remote')) { $filesystem->makeDirectory('remote'); } + return $filesystem; } }