Completed
Push — ft/package ( 7b41d6...ceb161 )
by Philippe
13:50
created
src/Authorization/Console/GeneratePermissionCommand.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function handle()
17 17
     {
18 18
         $scope = $this->getNameArgument();
19
-        $permissions = (false === strpos($scope,'-')) ? Permission::generate($scope) : [$scope];
19
+        $permissions = (false === strpos($scope, '-')) ? Permission::generate($scope) : [$scope];
20 20
 
21 21
         $this->createPermissions($permissions);
22 22
         $this->assignPermissionsToRoles($permissions);
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             Permission::findOrCreate($permission, 'chief');
40 40
         }
41 41
 
42
-        $this->info('Permissions ' . implode(', ', $permissions) . ' created.');
42
+        $this->info('Permissions '.implode(', ', $permissions).' created.');
43 43
     }
44 44
 
45 45
     /**
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
      */
48 48
     private function assignPermissionsToRoles($permissions)
49 49
     {
50
-        if(!$this->option('role')) return;
50
+        if (!$this->option('role')) return;
51 51
 
52 52
         $roleNames = explode(',', $this->option('role'));
53 53
 
54 54
         foreach ($roleNames as $roleName) {
55 55
             if ($role = Role::where('name', trim($roleName))->first()) {
56 56
                 $role->syncPermissions($permissions);
57
-                $this->info('Role ' . $roleName . ' assigned the given permissions.');
58
-            } else {
59
-                $this->warn('Role not found by name ' . $roleName . '!');
57
+                $this->info('Role '.$roleName.' assigned the given permissions.');
58
+            }else {
59
+                $this->warn('Role not found by name '.$roleName.'!');
60 60
             }
61 61
         }
62 62
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@
 block discarded – undo
47 47
      */
48 48
     private function assignPermissionsToRoles($permissions)
49 49
     {
50
-        if(!$this->option('role')) return;
50
+        if(!$this->option('role')) {
51
+            return;
52
+        }
51 53
 
52 54
         $roleNames = explode(',', $this->option('role'));
53 55
 
Please login to merge, or discard this patch.
src/Authorization/Role.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
     public function getPermissionsForIndex()
25 25
     {
26
-        $this->permissions->each(function($permission){
26
+        $this->permissions->each(function($permission) {
27 27
 
28 28
             $model = explode("_", $permission->name, 2)[1];
29 29
             $temp = $this->permission;
Please login to merge, or discard this patch.
src/Authorization/Permission.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
         $abilities = ['view', 'create', 'update', 'delete'];
21 21
 
22 22
         return array_map(function($val) use ($scope) {
23
-            return $val . '-'. $scope;
23
+            return $val.'-'.$scope;
24 24
         }, $abilities);
25 25
     }
26 26
 
Please login to merge, or discard this patch.
src/Pages/Console/GeneratePage.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
     private function publishModel()
61 61
     {
62 62
         $this->publishFile(
63
-            __DIR__ . '/stubs/model.php.stub',
64
-            $to = $this->dirs['model'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php',
63
+            __DIR__.'/stubs/model.php.stub',
64
+            $to = $this->dirs['model'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php',
65 65
             'model'
66 66
         );
67 67
     }
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
     private function publishController()
70 70
     {
71 71
         $this->publishFile(
72
-            __DIR__ . '/stubs/controller.php.stub',
73
-            $to = $this->dirs['controller'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php',
72
+            __DIR__.'/stubs/controller.php.stub',
73
+            $to = $this->dirs['controller'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php',
74 74
             'controller'
75 75
         );
76 76
     }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     protected function publishFile($from, $to, $type)
126 126
     {
127 127
         if ($this->filesystem->exists($to) && !$this->option('force')) {
128
-            if (!$this->confirm('File [' . $to . '] already exists? Overwrite this file?')) {
128
+            if (!$this->confirm('File ['.$to.'] already exists? Overwrite this file?')) {
129 129
                 return;
130 130
             }
131 131
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
         $to = str_replace($this->dirs['base'], '', realpath($to));
166 166
 
167
-        $this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>');
167
+        $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>');
168 168
     }
169 169
 
170 170
     protected function replacePlaceholders($content)
@@ -183,25 +183,25 @@  discard block
 block discarded – undo
183 183
     private function generateImportStatements(): string
184 184
     {
185 185
         return collect(['Illuminate\Database\Eloquent\Model'])
186
-            ->map(function ($statement) {
187
-                return 'use ' . $statement . ";\n    ";
186
+            ->map(function($statement) {
187
+                return 'use '.$statement.";\n    ";
188 188
             })->implode('');
189 189
     }
190 190
 
191 191
     private function generateTraitStatements(): string
192 192
     {
193 193
         return collect($this->chosenTraits)
194
-            ->map(function ($statement) {
195
-                return 'use ' . $statement . ";\n    ";
194
+            ->map(function($statement) {
195
+                return 'use '.$statement.";\n    ";
196 196
             })->implode('');
197 197
     }
198 198
 
199 199
     private function guessNamespace()
200 200
     {
201
-        if(isset($this->settings['namespace'])) return $this->settings['namespace'];
201
+        if (isset($this->settings['namespace'])) return $this->settings['namespace'];
202 202
 
203 203
         // We make an estimated guess based on the project name. At Think Tomorrow, we
204 204
         // have a src folder which is PSR-4 namespaced by the project name itself.
205
-        return ucfirst(config('thinktomorrow.chief.name','App')).'\\'. ucfirst($this->plural);
205
+        return ucfirst(config('thinktomorrow.chief.name', 'App')).'\\'.ucfirst($this->plural);
206 206
     }
207 207
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -198,7 +198,9 @@
 block discarded – undo
198 198
 
199 199
     private function guessNamespace()
200 200
     {
201
-        if(isset($this->settings['namespace'])) return $this->settings['namespace'];
201
+        if(isset($this->settings['namespace'])) {
202
+            return $this->settings['namespace'];
203
+        }
202 204
 
203 205
         // We make an estimated guess based on the project name. At Think Tomorrow, we
204 206
         // have a src folder which is PSR-4 namespaced by the project name itself.
Please login to merge, or discard this patch.
src/Pages/Application/CreatePage.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function handle(array $translations): Page
16 16
     {
17
-        DB::transaction(function(){
17
+        DB::transaction(function() {
18 18
 
19 19
         }, 2);
20 20
 
21
-        try{
21
+        try {
22 22
             DB::beginTransaction();
23 23
 
24 24
             $page = Page::create();
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
             return $page->fresh();
38 38
 
39
-        } catch(\Throwable $e){
39
+        } catch (\Throwable $e) {
40 40
             DB::rollBack();
41 41
             throw $e;
42 42
         }
Please login to merge, or discard this patch.
src/Pages/Application/UpdatePage.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function handle($id, array $translations, array $relations): Page
16 16
     {
17
-        try{
17
+        try {
18 18
             DB::beginTransaction();
19 19
 
20 20
             $page = Page::findOrFail($id);
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             DB::commit();
39 39
             return $page->fresh();
40 40
 
41
-        } catch(\Throwable $e){
41
+        } catch (\Throwable $e) {
42 42
             DB::rollBack();
43 43
             throw $e;
44 44
         }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
     private function savePageTranslations(Page $page, $translations)
48 48
     {
49
-        $translations = collect($translations)->map(function ($trans, $locale) {
49
+        $translations = collect($translations)->map(function($trans, $locale) {
50 50
             $trans['slug'] = strip_tags($trans['slug']);
51 51
 
52 52
             return $trans;
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
     private function syncRelations($page, $relateds)
61 61
     {
62 62
         // First remove all existing children
63
-        foreach($page->children() as $child){
63
+        foreach ($page->children() as $child) {
64 64
             $page->rejectChild($child);
65 65
         }
66 66
 
67
-        foreach(RelatedCollection::inflate($relateds) as $i => $related){
67
+        foreach (RelatedCollection::inflate($relateds) as $i => $related) {
68 68
             $page->adoptChild($related, ['sort' => $i]);
69 69
         }
70 70
     }
Please login to merge, or discard this patch.
src/Pages/Page.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,17 +52,17 @@
 block discarded – undo
52 52
 
53 53
     public function scopeSortedByCreated($query)
54 54
     {
55
-        $query->orderBy('created_at','DESC');
55
+        $query->orderBy('created_at', 'DESC');
56 56
     }
57 57
 
58 58
     public function presentForParent(ActsAsParent $parent, Relation $relation): string
59 59
     {
60
-        return 'Dit is de relatie weergave van een pagina onder ' . $parent->id;
60
+        return 'Dit is de relatie weergave van een pagina onder '.$parent->id;
61 61
     }
62 62
 
63 63
     public function presentForChild(ActsAsChild $child, Relation $relation): string
64 64
     {
65
-        return 'Dit is de relatie weergave van een pagina als parent voor ' . $child->id;
65
+        return 'Dit is de relatie weergave van een pagina als parent voor '.$child->id;
66 66
     }
67 67
 
68 68
     public function getRelationId(): string
Please login to merge, or discard this patch.
src/Pages/PageTranslation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,6 @@
 block discarded – undo
18 18
 
19 19
     public static function findBySlug($slug)
20 20
     {
21
-        return self::where('slug',$slug)->first();
21
+        return self::where('slug', $slug)->first();
22 22
     }
23 23
 }
Please login to merge, or discard this patch.
src/Users/UserPresenter.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     public function enabledAsLabel(): string
18 18
     {
19 19
         // Avoid showing enabled state if there is an invitation pending
20
-        if($this->user->invitation) return '';
20
+        if ($this->user->invitation) return '';
21 21
 
22 22
         return $this->user->isEnabled()
23 23
             ? ''
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
     public function enabledAsLabel(): string
18 18
     {
19 19
         // Avoid showing enabled state if there is an invitation pending
20
-        if($this->user->invitation) return '';
20
+        if($this->user->invitation) {
21
+            return '';
22
+        }
21 23
 
22 24
         return $this->user->isEnabled()
23 25
             ? ''
Please login to merge, or discard this patch.