Test Failed
Push — states-and-image-validation ( eea612...ef95ab )
by Ben
07:35
created
src/Urls/UrlSlugFields.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
     public static function redirectsFromModel(ProvidesUrl $model)
20 20
     {
21
-        $records = MemoizedUrlRecord::getByModel($model)->reject(function ($record) {
21
+        $records = MemoizedUrlRecord::getByModel($model)->reject(function($record) {
22 22
             return !$record->isRedirect();
23 23
         })->sortByDesc('created_at');
24 24
 
25 25
         $fields = new static([]);
26 26
 
27 27
         foreach ($records as $record) {
28
-            $key = 'redirects-' . $record->locale . '-' . $record->slug;
28
+            $key = 'redirects-'.$record->locale.'-'.$record->slug;
29 29
             $fields[$key] = UrlSlugField::make($key)
30 30
                 ->setUrlRecord($record)
31 31
                 ->setFullUrl($model->resolveUrl($record->locale, $record->slug));
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
         $fields = new static([]);
61 61
 
62 62
         foreach ($locales as $locale) {
63
-            $fields['url-slugs.' . $locale] = UrlSlugField::make('url-slugs.' . $locale)
63
+            $fields['url-slugs.'.$locale] = UrlSlugField::make('url-slugs.'.$locale)
64 64
                 ->setBaseUrlSegment($model->baseUrlSegment($locale))
65
-                ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)) . '/')
66
-                ->name('url-slugs[' . $locale . ']')
65
+                ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)).'/')
66
+                ->name('url-slugs['.$locale.']')
67 67
                 ->label($locale);
68 68
         }
69 69
 
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
      */
77 77
     private static function fillWithExistingValues(ProvidesUrl $model, self $fields): void
78 78
     {
79
-        $records = UrlRecord::getByModel($model)->reject(function ($record) {
79
+        $records = UrlRecord::getByModel($model)->reject(function($record) {
80 80
             return $record->isRedirect();
81 81
         })->sortBy('locale');
82 82
 
83 83
         foreach ($records as $record) {
84
-            if (!isset($fields['url-slugs.' . $record->locale])) {
84
+            if (!isset($fields['url-slugs.'.$record->locale])) {
85 85
                 continue;
86 86
             }
87 87
 
88
-            $fields['url-slugs.' . $record->locale]
88
+            $fields['url-slugs.'.$record->locale]
89 89
                 ->setUrlRecord($record)
90 90
                 ->setBaseUrlSegment($model->baseUrlSegment($record->locale))
91
-                ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) . '/');
91
+                ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).'/');
92 92
         }
93 93
     }
94 94
 }
Please login to merge, or discard this patch.
src/Relations/Relation.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             ->orderBy('sort', 'ASC')
53 53
             ->get();
54 54
 
55
-        return $relations->map(function (Relation $relation) {
55
+        return $relations->map(function(Relation $relation) {
56 56
             $parent = $relation->parent;
57 57
             $parent->relation = $relation;
58 58
 
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
             ->orderBy('sort', 'ASC')
68 68
             ->get();
69 69
 
70
-        return $relations->map(function (Relation $relation) use ($parent_type, $parent_id) {
70
+        return $relations->map(function(Relation $relation) use ($parent_type, $parent_id) {
71 71
 
72 72
             // It could be that the child itself is soft-deleted, if this is the case, we will ignore it and move on.
73 73
             if (!$child = $relation->child) {
74 74
                 if (!$relation->child()->withTrashed()->first()) {
75 75
 //                if ((!method_exists($childInstance, 'trashed')) || ! $childInstance->onlyTrashed()->find($relation->child_id)) {
76 76
                     // If we cannot retrieve it then he collection type is possibly off, this is a database inconsistency and should be addressed
77
-                    throw new \DomainException('Corrupt relation reference. Related child [' . $relation->child_type . '@' . $relation->child_id . '] could not be retrieved for parent [' . $parent_type . '@' . $parent_id . ']. Make sure the morph key can resolve to a valid class.');
77
+                    throw new \DomainException('Corrupt relation reference. Related child ['.$relation->child_type.'@'.$relation->child_id.'] could not be retrieved for parent ['.$parent_type.'@'.$parent_id.']. Make sure the morph key can resolve to a valid class.');
78 78
                 }
79 79
 
80 80
                 return null;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         })
87 87
 
88 88
             // In case of soft-deleted entries, this will be null and should be ignored. We make sure that keys are reset in case of removed child
89
-            ->reject(function ($child) {
89
+            ->reject(function($child) {
90 90
                 return is_null($child);
91 91
             })
92 92
             ->values();
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 
104 104
     public static function deleteRelationsOf($type, $id)
105 105
     {
106
-        $relations = static::where(function ($query) use ($type, $id) {
106
+        $relations = static::where(function($query) use ($type, $id) {
107 107
             return $query->where('parent_type', $type)
108 108
                 ->where('parent_id', $id);
109
-        })->orWhere(function ($query) use ($type, $id) {
109
+        })->orWhere(function($query) use ($type, $id) {
110 110
             return $query->where('child_type', $type)
111 111
                 ->where('child_id', $id);
112 112
         })->get();
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
     public static function deleteAllChildRelationsOf($type, $id)
120 120
     {
121
-        $relations = static::where(function ($query) use ($type, $id) {
121
+        $relations = static::where(function($query) use ($type, $id) {
122 122
             return $query->where('parent_type', $type)
123 123
                 ->where('parent_id', $id);
124 124
         })->get();
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
     public static function deleteAllParentRelationsOf($type, $id)
132 132
     {
133
-        $relations = static::where(function ($query) use ($type, $id) {
133
+        $relations = static::where(function($query) use ($type, $id) {
134 134
             return $query->where('child_type', $type)
135 135
                 ->where('child_id', $id);
136 136
         })->get();
Please login to merge, or discard this patch.
src/Relations/AvailableChildren.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function onlyModules(): Collection
35 35
     {
36
-        return $this->collection()->reject(function ($item) {
36
+        return $this->collection()->reject(function($item) {
37 37
             if ($item instanceof Page || $item instanceof StoredSetReference) {
38 38
                 return true;
39 39
             }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function onlyPages(): Collection
44 44
     {
45
-        return $this->collection()->filter(function ($item) {
45
+        return $this->collection()->filter(function($item) {
46 46
             if ($item instanceof Page) {
47 47
                 return true;
48 48
             }
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 
73 73
         // Merging the results of all the pages and all the modules, then filter by the config
74 74
         // This prevents us from having duplicates and also reduces the query load.
75
-        $collection = $collection->filter(function ($page) use ($available_children_types) {
75
+        $collection = $collection->filter(function($page) use ($available_children_types) {
76 76
             return in_array(get_class($page), $available_children_types);
77 77
         });
78 78
 
79 79
         // Filter out our already loaded pages and modules
80
-        $remaining_children_types = collect($available_children_types)->reject(function ($type) {
80
+        $remaining_children_types = collect($available_children_types)->reject(function($type) {
81 81
             return (new $type() instanceof Page || new $type() instanceof Module);
82 82
         });
83 83
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         }
90 90
 
91 91
         // Filter out our parent
92
-        return $this->collection = $collection->reject(function ($item) {
92
+        return $this->collection = $collection->reject(function($item) {
93 93
             if ($item instanceof $this->parent) {
94 94
                 return $item->id == $this->parent->id;
95 95
             }
Please login to merge, or discard this patch.
src/Concerns/Viewable/ViewPath.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function get(): string
36 36
     {
37
-        $basePath = $this->viewBasePath ? $this->viewBasePath . '.' : '';
37
+        $basePath = $this->viewBasePath ? $this->viewBasePath.'.' : '';
38 38
         $guessedParentViewName = $this->parent ? $this->parent->viewKey() : '';
39 39
         $guessedViewName = $this->viewable->viewKey();
40 40
 
41 41
         $viewPaths = [
42
-            $basePath . $guessedParentViewName . '.' . $guessedViewName,
43
-            $basePath . $guessedViewName,
44
-            $basePath . $guessedViewName . '.show',
45
-            $basePath . 'show',
42
+            $basePath.$guessedParentViewName.'.'.$guessedViewName,
43
+            $basePath.$guessedViewName,
44
+            $basePath.$guessedViewName.'.show',
45
+            $basePath.'show',
46 46
         ];
47 47
 
48 48
         // In case the collection set is made out of pages, we'll also allow to use the
49 49
         // generic collection page view for these sets as well as a fallback view
50 50
         if ($this->viewable instanceof Set && $this->viewable->first() instanceof ViewableContract) {
51
-            $viewPaths[] = $basePath . $guessedParentViewName . '.' . $this->viewable->first()->viewKey();
52
-            $viewPaths[] = $basePath . $this->viewable->first()->viewKey();
51
+            $viewPaths[] = $basePath.$guessedParentViewName.'.'.$this->viewable->first()->viewKey();
52
+            $viewPaths[] = $basePath.$this->viewable->first()->viewKey();
53 53
         }
54 54
 
55 55
         foreach ($viewPaths as $viewPath) {
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
             return $viewPath;
61 61
         }
62 62
 
63
-        if (!view()->exists($basePath . 'show')) {
64
-            throw new NotFoundView('Viewfile not found for [' . get_class($this->viewable) . ']. Make sure the view [' . $basePath . $guessedViewName . '] or the default view [' . $basePath . 'show] exists.');
63
+        if (!view()->exists($basePath.'show')) {
64
+            throw new NotFoundView('Viewfile not found for ['.get_class($this->viewable).']. Make sure the view ['.$basePath.$guessedViewName.'] or the default view ['.$basePath.'show] exists.');
65 65
         }
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
src/Concerns/Sluggable/UniqueSlug.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         $this->model = $model;
21 21
         $this->blacklist = $blacklist;
22 22
 
23
-        $this->slugResolver = function ($slug) {
23
+        $this->slugResolver = function($slug) {
24 24
             return Str::slug($slug);
25 25
         };
26 26
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $i = 1;
44 44
 
45 45
         while (!$this->isSlugUnique($slug, $entity)) {
46
-            $slug = $originalslug . '-' . $i;
46
+            $slug = $originalslug.'-'.$i;
47 47
             $i++;
48 48
         }
49 49
 
Please login to merge, or discard this patch.
src/Concerns/Translatable/TranslatableController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@
 block discarded – undo
23 23
             }
24 24
 
25 25
             foreach ($rules as $key => $rule) {
26
-                $translationrules['trans.' . $locale . '.' . $key] = $rule;
26
+                $translationrules['trans.'.$locale.'.'.$key] = $rule;
27 27
             }
28 28
 
29 29
             foreach ($attributes as $key => $attribute) {
30
-                $translationattributes['trans.' . $locale . '.' . $key] = $attribute;
30
+                $translationattributes['trans.'.$locale.'.'.$key] = $attribute;
31 31
             }
32 32
 
33 33
             foreach ($messages as $key => $message) {
34
-                $translationmessages['trans.' . $locale . '.' . $key] = $message;
34
+                $translationmessages['trans.'.$locale.'.'.$key] = $message;
35 35
             }
36 36
         }
37 37
 
Please login to merge, or discard this patch.
src/Menu/ChiefMenu.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     {
26 26
         $collection = NodeCollection::fromArray($items);
27 27
 
28
-        $collection->mapRecursive(function ($node) {
28
+        $collection->mapRecursive(function($node) {
29 29
             return $node->replaceEntry((new MenuItem())->entry($node));
30 30
         });
31 31
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     public function items(): NodeCollection
43 43
     {
44 44
         if (!$this->includeHidden) {
45
-            $this->collection = $this->collection->shake(function ($node) {
45
+            $this->collection = $this->collection->shake(function($node) {
46 46
                 return !$node->hidden_in_menu && !$node->draft;
47 47
             });
48 48
         }
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
         $this->collection = $this->items();
56 56
 
57 57
         if ($id) {
58
-            $this->collection = $this->collection->prune(function ($node) use ($id) {
58
+            $this->collection = $this->collection->prune(function($node) use ($id) {
59 59
                 return !in_array($id, $node->pluckAncestors('id'));
60 60
             });
61 61
         }
62 62
 
63
-        $menu = $this->collection->mapRecursive(function ($node) {
63
+        $menu = $this->collection->mapRecursive(function($node) {
64 64
             $entry = $node->entry();
65 65
             $label = $entry->label;
66
-            $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())) . '>' : '';
66
+            $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())).'>' : '';
67 67
             $entry->label .= $label;
68 68
 
69 69
             return $node->replaceEntry($entry);
70 70
         });
71 71
 
72 72
         $menuitems = collect();
73
-        $menu->flatten()->each(function ($node) use ($menuitems) {
73
+        $menu->flatten()->each(function($node) use ($menuitems) {
74 74
             $menuitems[] = [
75 75
                 'label' => $node->label,
76 76
                 'id'    => $node->id,
Please login to merge, or discard this patch.
src/Menu/Application/UpdateMenu.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
         if (in_array($menu->order, $sequence)) {
55 55
             foreach ($sequence as $id => $order) {
56 56
                 if ($order < $menu->order) {
57
-                } else {
57
+                }else {
58 58
                     $sequence[$id]++;
59 59
                 }
60 60
             }
61 61
         }
62 62
 
63
-        $sequence = $sequence + [$menu->id => $menu->order];
63
+        $sequence = $sequence+[$menu->id => $menu->order];
64 64
 
65 65
         asort($sequence);
66 66
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
     private function reorder(array $sequence)
71 71
     {
72
-        array_walk($sequence, function ($order, $id) {
72
+        array_walk($sequence, function($order, $id) {
73 73
             MenuItem::withoutGlobalScope(SoftDeletingScope::class)
74 74
                 ->where('id', $id)
75 75
                 ->update(['order' => $order]);
Please login to merge, or discard this patch.
src/Menu/Menu.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $types = config('thinktomorrow.chief.menus', []);
28 28
 
29
-        return collect($types)->map(function ($menu, $key) {
29
+        return collect($types)->map(function($menu, $key) {
30 30
             return new static($key, $menu['label'], $menu['view']);
31 31
         });
32 32
     }
33 33
 
34 34
     public static function find($key): ?self
35 35
     {
36
-        return static::all()->filter(function ($menu) use ($key) {
36
+        return static::all()->filter(function($menu) use ($key) {
37 37
             return $menu->key() == $key;
38 38
         })->first();
39 39
     }
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $menu = [];
84 84
 
85
-        $this->items()->each(function ($item) use (&$menu) {
85
+        $this->items()->each(function($item) use (&$menu) {
86 86
             $menu[] = sprintf('<li><a href="%s">%s</a></li>', $item->url, $item->label);
87 87
         });
88 88
 
89
-        return '<ul>' . implode('', $menu) . '</ul>';
89
+        return '<ul>'.implode('', $menu).'</ul>';
90 90
     }
91 91
 }
Please login to merge, or discard this patch.