From 7716911dd9cd6ef25c73bec4e6eed483e68958ef Mon Sep 17 00:00:00 2001 From: Robert Kummer Date: Wed, 24 Jan 2018 10:25:09 +0000 Subject: [PATCH] Apply fixes from StyleCI --- app/Jobs/CreateLocalFile.php | 98 ++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/app/Jobs/CreateLocalFile.php b/app/Jobs/CreateLocalFile.php index 1f8b777..b1fa37a 100644 --- a/app/Jobs/CreateLocalFile.php +++ b/app/Jobs/CreateLocalFile.php @@ -9,63 +9,63 @@ class CreateLocalFile { - use Dispatchable; + use Dispatchable; - /** - * @var \Illuminate\Http\UploadedFile - */ - private $file; + /** + * @var \Illuminate\Http\UploadedFile + */ + private $file; - /** - * @var string - */ - private $reference; + /** + * @var string + */ + private $reference; - public function __construct(string $reference, UploadedFile $file) - { - $this->reference = $reference; - $this->file = $file; - } + public function __construct(string $reference, UploadedFile $file) + { + $this->reference = $reference; + $this->file = $file; + } - /** - * Execute the job. - * - * @return void - */ - public function handle() - { - $fileHandle = $this->file->openFile(); - $content = $fileHandle->fread($this->file->getSize()); + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + $fileHandle = $this->file->openFile(); + $content = $fileHandle->fread($this->file->getSize()); - $proxyFile = new ProxyFile([ - 'reference' => $this->reference, - 'type' => 'local', - 'filename' => $this->file->getClientOriginalName(), - 'mimetype' => $this->file->getClientMimeType(), - 'size' => $this->file->getSize(), - 'checksum' => sha1($content), - ]); - $proxyFile->save(); + $proxyFile = new ProxyFile([ + 'reference' => $this->reference, + 'type' => 'local', + 'filename' => $this->file->getClientOriginalName(), + 'mimetype' => $this->file->getClientMimeType(), + 'size' => $this->file->getSize(), + 'checksum' => sha1($content), + ]); + $proxyFile->save(); - /** @var \App\LocalFile $localFile */ - $localFile = $proxyFile->localFile()->create([ - 'path' => uniqid('', true), - ]); + /** @var \App\LocalFile $localFile */ + $localFile = $proxyFile->localFile()->create([ + 'path' => uniqid('', true), + ]); - /** @var Filesystem|\Illuminate\Filesystem\FilesystemAdapter $filesystem */ - $filesystem = app(Filesystem::class); + /** @var Filesystem|\Illuminate\Filesystem\FilesystemAdapter $filesystem */ + $filesystem = app(Filesystem::class); - if (!$filesystem->exists('local')) { - $filesystem->makeDirectory('local'); - } + if (! $filesystem->exists('local')) { + $filesystem->makeDirectory('local'); + } - $path = $localFile->getLocalStoragePath(); + $path = $localFile->getLocalStoragePath(); - $fh = fopen($this->file->getRealPath(), 'rb'); - if ($filesystem->put($path, $fh)) { - $localFile->path = $path; - $localFile->save(); - } - fclose($fh); - } + $fh = fopen($this->file->getRealPath(), 'rb'); + if ($filesystem->put($path, $fh)) { + $localFile->path = $path; + $localFile->save(); + } + fclose($fh); + } }