Test Setup Failed
Push — a-simpler-manager ( c7b435...29c609 )
by Ben
09:30
created
src/Mediagallery/Application/RemovalAction.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,24 +22,24 @@
 block discarded – undo
22 22
     public function handle(Request $request)
23 23
     {
24 24
         // Strict protection enabled: we won't remove assets who are still being used...
25
-        $assetIds = collect($request->input('asset_ids', []))->reject(function($assetId){
25
+        $assetIds = collect($request->input('asset_ids', []))->reject(function($assetId) {
26 26
             return DB::table('asset_pivots')
27 27
                 ->where('asset_id', $assetId)
28 28
                 ->where('unused', 0)
29 29
                 ->exists();
30 30
         })->toArray();
31 31
 
32
-        if($assetIds)
32
+        if ($assetIds)
33 33
         {
34
-                foreach($assetIds as $k => $assetId) {
35
-                    try{
34
+                foreach ($assetIds as $k => $assetId) {
35
+                    try {
36 36
                         $this->deleteAsset->remove($assetId);
37
-                    } catch(FileNotAccessibleException $e) {
37
+                    } catch (FileNotAccessibleException $e) {
38 38
                         unset($assetIds[$k]); // So our count of removed assets is correct in the log.
39 39
                     }
40 40
                 }
41 41
 
42
-                Audit::activity()->log('removed ' . count($assetIds) . ' assets from the mediagallery.');
42
+                Audit::activity()->log('removed '.count($assetIds).' assets from the mediagallery.');
43 43
 
44 44
                 return true;
45 45
         }
Please login to merge, or discard this patch.
src/Mediagallery/Application/ZipAction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function handle(string $filename, Request $request)
19 19
     {
20
-        $assets = Asset::whereIn('id', (array) $request->input('asset_ids', []))->get();
20
+        $assets = Asset::whereIn('id', (array)$request->input('asset_ids', []))->get();
21 21
 
22 22
         // enable output of HTTP headers TODO: this should be moved to the controller instead...
23 23
         $options = new Archive();
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $zip = new ZipStream($filename, $options);
27 27
 
28 28
         $assets->each(function(Asset $asset) use($zip){
29
-            if(file_exists($asset->getFirstMediaPath())) {
29
+            if (file_exists($asset->getFirstMediaPath())) {
30 30
                 $zip->addFileFromPath($asset->filename(), $asset->getFirstMediaPath());
31 31
             }
32 32
         });
Please login to merge, or discard this patch.
src/Mediagallery/Http/BulkActionsController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,18 +24,18 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function bulk(Request $request)
26 26
     {
27
-        if($request->input('type') == 'download') {
27
+        if ($request->input('type') == 'download') {
28 28
             return $this->download($request);
29 29
         }
30 30
 
31
-        if($request->input('type') == 'remove') {
31
+        if ($request->input('type') == 'remove') {
32 32
             return $this->remove($request);
33 33
         }
34 34
     }
35 35
 
36 36
     private function download(Request $request)
37 37
     {
38
-        $filename = Str::slug(config('app.name')) . '_assets_' . date('YmdHis') . '.zip';
38
+        $filename = Str::slug(config('app.name')).'_assets_'.date('YmdHis').'.zip';
39 39
 
40 40
         // TODO: do the response here instead of the zip action itself
41 41
         return $this->zipAction->handle($filename, $request);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $result = $this->removalAction->handle($request);
47 47
 
48
-        if($result) {
48
+        if ($result) {
49 49
             return redirect()->back()->with('messages.success', 'De mediabestanden zijn verwijderd');
50 50
         }
51 51
 
Please login to merge, or discard this patch.
src/Urls/ChiefResponse.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
                     $targetModel = Morphables::instance($targetUrlRecord->model_type)->find($targetUrlRecord->model_id);
40 40
 
41 41
                     if (!$targetModel) {
42
-                        throw new ArchivedUrlException('Corrupt target model for this url request. Model by reference [' . $targetUrlRecord->model_type . '@' . $targetUrlRecord->model_id . '] has probably been archived or deleted.');
42
+                        throw new ArchivedUrlException('Corrupt target model for this url request. Model by reference ['.$targetUrlRecord->model_type.'@'.$targetUrlRecord->model_id.'] has probably been archived or deleted.');
43 43
                     }
44 44
 
45 45
                     return static::createRedirect($targetModel->url($locale));
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
             }
50 50
 
51 51
             if (!$model) {
52
-                throw new ArchivedUrlException('Corrupt target model for this url request. Model by reference [' . $urlRecord->model_type . '@' . $urlRecord->model_id . '] has probably been archived or deleted.');
52
+                throw new ArchivedUrlException('Corrupt target model for this url request. Model by reference ['.$urlRecord->model_type.'@'.$urlRecord->model_id.'] has probably been archived or deleted.');
53 53
             }
54 54
 
55 55
             if (method_exists($model, 'isPublished') && !$model->isPublished()) {
56 56
 
57 57
                 /** When admin is logged in and this request is in preview mode, we allow the view */
58 58
                 if (!PreviewMode::fromRequest()->check()) {
59
-                    throw new NotFoundHttpException('Model found for request [' . $slug . '] but it is not published.');
59
+                    throw new NotFoundHttpException('Model found for request ['.$slug.'] but it is not published.');
60 60
                 }
61 61
             }
62 62
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             }
68 68
         }
69 69
 
70
-        throw new NotFoundHttpException('No url or model found for request [' . $slug . '] for locale [' . $locale . '].');
70
+        throw new NotFoundHttpException('No url or model found for request ['.$slug.'] for locale ['.$locale.'].');
71 71
     }
72 72
 
73 73
     private static function createRedirect(string $url)
Please login to merge, or discard this patch.
src/OLD/Management/Assistants/ManagesAssistants.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
     public function assistant(string $assistantKey): Assistant
52 52
     {
53 53
         if (!$this->isAssistedBy($assistantKey)) {
54
-            throw new MissingAssistant('No assistant [' . $assistantKey . '] registered on manager ' . static::class);
54
+            throw new MissingAssistant('No assistant ['.$assistantKey.'] registered on manager '.static::class);
55 55
         }
56 56
 
57 57
         $instance = app($this->getAssistantClass($assistantKey));
Please login to merge, or discard this patch.
src/OLD/Management/Register.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
     private function registrationMustExistConstraint(string $key, $value, $registrations): void
137 137
     {
138 138
         if (empty($registrations) && count($registrations) != $this->registrations) {
139
-            throw new NonRegisteredManager('No manager found for ' . $key . ' [' . print_r($value, true) . ']. Did you perhaps forgot to register the manager?');
139
+            throw new NonRegisteredManager('No manager found for '.$key.' ['.print_r($value, true).']. Did you perhaps forgot to register the manager?');
140 140
         }
141 141
     }
142 142
 }
Please login to merge, or discard this patch.
src/OLD/Management/Registration.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,21 +75,21 @@
 block discarded – undo
75 75
     private function validate($managerClass, $modelClass)
76 76
     {
77 77
         if (!class_exists($managerClass)) {
78
-            throw new \InvalidArgumentException('Manager class [' . $managerClass . '] is an invalid class reference. Please make sure the class exists.');
78
+            throw new \InvalidArgumentException('Manager class ['.$managerClass.'] is an invalid class reference. Please make sure the class exists.');
79 79
         }
80 80
 
81 81
         if (!class_exists($modelClass)) {
82
-            throw new \InvalidArgumentException('Model class [' . $modelClass . '] is an invalid model reference. Please make sure the class exists.');
82
+            throw new \InvalidArgumentException('Model class ['.$modelClass.'] is an invalid model reference. Please make sure the class exists.');
83 83
         }
84 84
 
85 85
         $manager = new \ReflectionClass($managerClass);
86 86
         if (!$manager->implementsInterface(Manager::class)) {
87
-            throw new \InvalidArgumentException('Class [' . $managerClass . '] is expected to implement the [' . Manager::class . '] contract.');
87
+            throw new \InvalidArgumentException('Class ['.$managerClass.'] is expected to implement the ['.Manager::class.'] contract.');
88 88
         }
89 89
 
90 90
         $model = new \ReflectionClass($modelClass);
91 91
         if (!$model->implementsInterface(ManagedModel::class)) {
92
-            throw new \InvalidArgumentException('Class [' . $modelClass . '] is expected to implement the [' . ManagedModel::class . '] contract.');
92
+            throw new \InvalidArgumentException('Class ['.$modelClass.'] is expected to implement the ['.ManagedModel::class.'] contract.');
93 93
         }
94 94
     }
95 95
 }
Please login to merge, or discard this patch.
src/OLD/Management/Managers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $registrations = collect($this->register->filterByTag($tag)->all());
52 52
 
53
-        return $registrations->map(function ($registration) {
53
+        return $registrations->map(function($registration) {
54 54
             return $this->instance($registration);
55 55
         });
56 56
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $registrations = collect($this->register->filterByTag($tag)->all());
67 67
 
68
-        return $registrations->map(function ($registration) {
68
+        return $registrations->map(function($registration) {
69 69
             return $this->instance($registration)->details();
70 70
         });
71 71
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         //return array with group name and values
77 77
         $grouped = [];
78 78
 
79
-        $managers = $managers->map(function (Manager $item) {
79
+        $managers = $managers->map(function(Manager $item) {
80 80
             return [
81 81
                 'id'    => $item->details()->id,
82 82
                 'group' => $item->details()->plural,
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $registrations = collect($this->register->all());
92 92
 
93
-        return $registrations->map(function ($registration) {
93
+        return $registrations->map(function($registration) {
94 94
             return $this->instance($registration);
95 95
         });
96 96
     }
Please login to merge, or discard this patch.
src/OLD/Management/Exceptions/NotAllowedManagerAction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
 
41 41
     public static function notAllowedAction($action, string $managerKey)
42 42
     {
43
-        return new self('Not allowed to ' . $action . ' a model. ' . ucfirst($action) . ' route is not allowed by the ' . $managerKey . ' manager.');
43
+        return new self('Not allowed to '.$action.' a model. '.ucfirst($action).' route is not allowed by the '.$managerKey.' manager.');
44 44
     }
45 45
 
46 46
     public static function notAllowedPermission($permission, string $managerKey)
47 47
     {
48
-        return new self('Not allowed permission for ' . $permission . ' on a model as managed by the ' . $managerKey . ' manager.');
48
+        return new self('Not allowed permission for '.$permission.' on a model as managed by the '.$managerKey.' manager.');
49 49
     }
50 50
 }
Please login to merge, or discard this patch.