Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit c85e313

Browse files
committed
[FIX] Sorting import by length StyleCI
1 parent 4d25f84 commit c85e313

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

app/Http/Controllers/Api/Assets/UploadFileController.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
namespace App\Http\Controllers\Api\Assets;
44

5+
use GuzzleHttp\Client;
6+
use Illuminate\Support\Str;
7+
use Illuminate\Http\Request;
58
use App\Entities\Assets\Asset;
9+
use Dingo\Api\Routing\Helpers;
610
use App\Events\AssetWasCreated;
7-
use App\Exceptions\BodyTooLargeException;
811
use App\Http\Controllers\Controller;
12+
use Illuminate\Support\Facades\Storage;
13+
use App\Exceptions\BodyTooLargeException;
14+
use GuzzleHttp\Exception\TransferException;
915
use App\Transformers\Assets\AssetTransformer;
1016
use Dingo\Api\Exception\StoreResourceFailedException;
11-
use Dingo\Api\Routing\Helpers;
12-
use GuzzleHttp\Client;
13-
use GuzzleHttp\Exception\TransferException;
14-
use Illuminate\Http\Request;
15-
use Illuminate\Support\Facades\Storage;
16-
use Illuminate\Support\Str;
1717

1818
/**
1919
* Class UploadFileController.
@@ -82,7 +82,7 @@ public function store(Request $request)
8282
'user' => $request->user(),
8383
]);
8484
} else {
85-
$body = ! (base64_decode($request->getContent())) ? $request->getContent() : base64_decode($request->getContent());
85+
$body = !(base64_decode($request->getContent())) ? $request->getContent() : base64_decode($request->getContent());
8686
$asset = $this->uploadFromDirectFile([
8787
'mime' => $request->header('Content-Type'),
8888
'content' => $body,
@@ -135,7 +135,7 @@ protected function storeInDatabase(array $attributes, $path)
135135
'type' => $this->validMimes[$attributes['mime']]['type'],
136136
'path' => $path,
137137
'mime' => $attributes['mime'],
138-
'user_id' => ! empty($attributes['user']) ? $attributes['user']->id : null,
138+
'user_id' => !empty($attributes['user']) ? $attributes['user']->id : null,
139139
]);
140140

141141
return $file;
@@ -147,7 +147,7 @@ protected function storeInDatabase(array $attributes, $path)
147147
*/
148148
protected function storeInFileSystem(array $attributes)
149149
{
150-
$path = md5(Str::random(16).date('U')).'.'.$this->validMimes[$attributes['mime']]['extension'];
150+
$path = md5(Str::random(16) . date('U')) . '.' . $this->validMimes[$attributes['mime']]['extension'];
151151
Storage::put($path, $attributes['content']);
152152

153153
return $path;
@@ -170,7 +170,7 @@ protected function callFileUrl($url)
170170
return $response;
171171
} catch (TransferException $e) {
172172
throw new StoreResourceFailedException('Validation Error', [
173-
'url' => 'The url seems to be unreachable: '.$e->getCode(),
173+
'url' => 'The url seems to be unreachable: ' . $e->getCode(),
174174
]);
175175
}
176176
}
@@ -180,7 +180,7 @@ protected function callFileUrl($url)
180180
*/
181181
protected function validateMime($mime)
182182
{
183-
if (! array_key_exists($mime, $this->validMimes)) {
183+
if (!array_key_exists($mime, $this->validMimes)) {
184184
throw new StoreResourceFailedException('Validation Error', [
185185
'Content-Type' => 'The Content Type sent is not valid',
186186
]);

0 commit comments

Comments
 (0)