Passed
Pull Request — master (#17)
by ARCANEDEV
05:21
created
src/MediaServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
             Providers\RouteServiceProvider::class,
51 51
         ]);
52 52
 
53
-        $this->app->booting(function ($app) {
53
+        $this->app->booting(function($app) {
54 54
             /** @var  \Illuminate\Contracts\Config\Repository  $config */
55 55
             $config = $app['config'];
56 56
 
Please login to merge, or discard this patch.
src/Http/Controllers/MediaApiController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
         $type = $request->get('type');
151 151
         $path = $request->get('path');
152 152
 
153
-        if ($type === MediaItem::TYPE_FILE){
153
+        if ($type === MediaItem::TYPE_FILE) {
154 154
             $this->manager->deleteFile($path);
155 155
         }
156 156
         elseif ($type === MediaItem::TYPE_DIRECTORY) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@  discard block
 block discarded – undo
30 30
 
31 31
         $location = $request->get('location', '/');
32 32
 
33
-        if ( ! $this->manager->exists($location))
34
-            return static::jsonResponseError(['message' => 'Location not found'], 404);
33
+        if ( ! $this->manager->exists($location)) {
34
+                    return static::jsonResponseError(['message' => 'Location not found'], 404);
35
+        }
35 36
 
36 37
         return static::jsonResponse(
37 38
             $this->manager->all($location)->values()->toArray()
@@ -152,11 +153,9 @@  discard block
 block discarded – undo
152 153
 
153 154
         if ($type === MediaItem::TYPE_FILE){
154 155
             $this->manager->deleteFile($path);
155
-        }
156
-        elseif ($type === MediaItem::TYPE_DIRECTORY) {
156
+        } elseif ($type === MediaItem::TYPE_DIRECTORY) {
157 157
             $this->manager->deleteDirectory($path);
158
-        }
159
-        else {
158
+        } else {
160 159
             // TODO: Throw an exception ?
161 160
         }
162 161
 
Please login to merge, or discard this patch.
src/Http/Routes/MediaRoutes.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $this->adminGroup(function () {
27 27
             $this->prefix('media')->name('media.')->group(function () {
28 28
                 $this->get('/', [MediaController::class, 'index'])
29
-                     ->name('index'); // admin::media.index
29
+                        ->name('index'); // admin::media.index
30 30
 
31 31
                 $this->mapApiRoutes();
32 32
             });
@@ -40,28 +40,28 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $this->prefix('api')->name('api.')->middleware(['ajax'])->group(function () {
42 42
             $this->get('items', [MediaApiController::class, 'all'])
43
-                 ->name('items.index'); // admin::media.api.items.index
43
+                    ->name('items.index'); // admin::media.api.items.index
44 44
 
45 45
             $this->get('directories', [MediaApiController::class, 'directories'])
46
-                 ->name('directories.index'); // admin::media.api.directories.index
46
+                    ->name('directories.index'); // admin::media.api.directories.index
47 47
 
48 48
             $this->post('upload', [MediaApiController::class, 'upload'])
49
-                 ->name('upload'); // admin::media.api.upload
49
+                    ->name('upload'); // admin::media.api.upload
50 50
 
51 51
             $this->post('new-folder', [MediaApiController::class, 'newFolder'])
52
-                 ->name('new-folder'); // admin::media.api.new-folder
52
+                    ->name('new-folder'); // admin::media.api.new-folder
53 53
 
54 54
             $this->put('move', [MediaApiController::class, 'move'])
55
-                 ->name('move'); // admin::media.api.move
55
+                    ->name('move'); // admin::media.api.move
56 56
 
57 57
             $this->put('rename', [MediaApiController::class, 'rename'])
58
-                 ->name('rename'); // admin::media.api.rename
58
+                    ->name('rename'); // admin::media.api.rename
59 59
 
60 60
             $this->delete('delete', [MediaApiController::class, 'delete'])
61
-                 ->name('delete'); // admin::media.api.delete
61
+                    ->name('delete'); // admin::media.api.delete
62 62
 
63 63
             $this->get('download', [MediaApiController::class, 'download'])
64
-                 ->name('download'); // admin::media.api.delete
64
+                    ->name('download'); // admin::media.api.delete
65 65
         });
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function map(): void
25 25
     {
26
-        $this->adminGroup(function () {
27
-            $this->prefix('media')->name('media.')->group(function () {
26
+        $this->adminGroup(function() {
27
+            $this->prefix('media')->name('media.')->group(function() {
28 28
                 $this->get('/', [MediaController::class, 'index'])
29 29
                      ->name('index'); // admin::media.index
30 30
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     private function mapApiRoutes(): void
40 40
     {
41
-        $this->prefix('api')->name('api.')->middleware(['ajax'])->group(function () {
41
+        $this->prefix('api')->name('api.')->middleware(['ajax'])->group(function() {
42 42
             $this->get('items', [MediaApiController::class, 'all'])
43 43
                  ->name('items.index'); // admin::media.api.items.index
44 44
 
Please login to merge, or discard this patch.
src/Http/Requests/RenameMediaRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      */
27 27
     public function rules()
28 28
     {
29
-        $manager  = static::getMediaManager();
29
+        $manager = static::getMediaManager();
30 30
 
31 31
         return [
32 32
             'old_path' => ['required', 'string', new MediaItemExistsRule($manager)],
Please login to merge, or discard this patch.
src/MediaManager.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $disk        = $this->disk();
94 94
         $directories = $disk->directories($directory, $recursive);
95 95
 
96
-        return MediaCollection::directories(array_map(function ($path) use ($disk) {
96
+        return MediaCollection::directories(array_map(function($path) use ($disk) {
97 97
             return [
98 98
                 'name' => basename($path),
99 99
             ];
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $disk  = $this->disk();
114 114
         $files = $disk->files($directory, $recursive);
115 115
 
116
-        return MediaCollection::files(array_map(function ($path) use ($disk) {
116
+        return MediaCollection::files(array_map(function($path) use ($disk) {
117 117
             return [
118 118
                 'name'         => basename($path),
119 119
                 'path'         => $path,
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function file(string $path)
137 137
     {
138
-        return $this->files(dirname($path))->first(function (FileItem $file) use ($path) {
138
+        return $this->files(dirname($path))->first(function(FileItem $file) use ($path) {
139 139
             return $file->path === $path;
140
-        }, function () use ($path) {
140
+        }, function() use ($path) {
141 141
             throw new FileNotFoundException("File [$path] not found!");
142 142
         });
143 143
     }
144 144
 
145 145
     public function directory(string $path)
146 146
     {
147
-        return $this->directories(dirname($path))->first(function (DirectoryItem $directory) use ($path) {
147
+        return $this->directories(dirname($path))->first(function(DirectoryItem $directory) use ($path) {
148 148
             return $directory->path === $path;
149
-        }, function () use ($path) {
149
+        }, function() use ($path) {
150 150
             throw new DirectoryNotFoundException("Directory [$path] not found!");
151 151
         });
152 152
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -160,8 +160,9 @@
 block discarded – undo
160 160
      */
161 161
     public function exists($path): bool
162 162
     {
163
-        if ($path === '/')
164
-            return true;
163
+        if ($path === '/') {
164
+                    return true;
165
+        }
165 166
 
166 167
         return $this->disk()->exists($path);
167 168
     }
Please login to merge, or discard this patch.