Test Setup Failed
Push — a-simpler-manager ( c7b435...29c609 )
by Ben
09:30
created
src/OLD/Management/Details/HasDetails.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         $genericModelInstance = $this->modelInstance();
17 17
 
18 18
         // Generic model details
19
-        $id = Str::slug($this->registration->key() . ($this->hasExistingModel() ? '-' . $this->existingModel()->id : ''));
19
+        $id = Str::slug($this->registration->key().($this->hasExistingModel() ? '-'.$this->existingModel()->id : ''));
20 20
         $key = $this->registration->key();
21 21
         $labelSingular = property_exists($genericModelInstance, 'labelSingular') ? $genericModelInstance->labelSingular : Str::singular($key);
22 22
         $labelPlural = property_exists($genericModelInstance, 'labelPlural') ? $genericModelInstance->labelPlural : Str::plural($key);
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
         return new Details(
33 33
             $id,
34 34
             $key,
35
-            $labelSingular . '',
36
-            $labelPlural . '',
35
+            $labelSingular.'',
36
+            $labelPlural.'',
37 37
             $internal_label,
38
-            $title . ''
38
+            $title.''
39 39
         );
40 40
     }
41 41
 }
Please login to merge, or discard this patch.
src/Nav/NavItem.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function isTagged($tags): bool
33 33
     {
34
-        return count(array_intersect($this->tags, (array) $tags)) > 0;
34
+        return count(array_intersect($this->tags, (array)$tags)) > 0;
35 35
     }
36 36
 
37 37
     public function isUntagged(): bool
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     public function render(): string
43 43
     {
44
-        $output = '<a class="' . (isActiveUrl($this->url()) ? 'active' : '') . '" href="' . $this->url() . '">';
44
+        $output = '<a class="'.(isActiveUrl($this->url()) ? 'active' : '').'" href="'.$this->url().'">';
45 45
         $output .= ucfirst($this->label());
46 46
         $output .= '</a>';
47 47
 
Please login to merge, or discard this patch.
src/Nav/Nav.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function untagged(): self
32 32
     {
33
-        $filteredItems = array_filter($this->items, function(NavItem $navItem){
33
+        $filteredItems = array_filter($this->items, function(NavItem $navItem) {
34 34
             return $navItem->isUntagged();
35 35
         });
36 36
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $instance = new static();
43 43
 
44
-        foreach($navItems as $item) {
44
+        foreach ($navItems as $item) {
45 45
             $instance->add($item);
46 46
         }
47 47
 
@@ -55,21 +55,21 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function render(): string
57 57
     {
58
-        return array_reduce($this->items, function($carry, $item){
59
-            return $carry .'<li>'. $item->render() . '</li>';
58
+        return array_reduce($this->items, function($carry, $item) {
59
+            return $carry.'<li>'.$item->render().'</li>';
60 60
         } ,'');
61 61
     }
62 62
 
63 63
     public function renderDropdown(string $label): string
64 64
     {
65
-        $items = array_reduce($this->items, function($carry, $item){
66
-            return $carry . $item->render();
65
+        $items = array_reduce($this->items, function($carry, $item) {
66
+            return $carry.$item->render();
67 67
         } ,'');
68 68
 
69 69
         // Surround with vue dropdown
70 70
         $output = '<dropdown>';
71
-        $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">' . $label . '</span>';
72
-        $output .= '<div v-cloak class="dropdown-box inset-s">' . $items . '</div></dropdown>';
71
+        $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'.$label.'</span>';
72
+        $output .= '<div v-cloak class="dropdown-box inset-s">'.$items.'</div></dropdown>';
73 73
 
74 74
         return $output;
75 75
     }
Please login to merge, or discard this patch.
src/Menu/MenuItem.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             if ($item->ofType(static::TYPE_INTERNAL) && $page = $item->page) {
105 105
                 if (public_method_exists($page, 'isArchived') && $page->isArchived()) {
106 106
                     unset($items[$k]);
107
-                } else {
107
+                }else {
108 108
                     $item->url = self::composePageUrl($item, $page);
109 109
                     $item->page_label = public_method_exists($page, 'menuLabel') ? $page->menuLabel() : '';
110 110
                     $item->hidden_in_menu = $page->hidden_in_menu;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             'id'             => $node->id,
154 154
             'type'           => $node->type,
155 155
             'label'          => $node->label,
156
-            'page_label'     => $node->page_label,                       // Extra info when dealing with internal links
156
+            'page_label'     => $node->page_label, // Extra info when dealing with internal links
157 157
             'url'            => $node->url,
158 158
             'order'          => $node->order,
159 159
             'page_id'        => $node->page_id,
Please login to merge, or discard this patch.
src/Urls/Field/Url.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Thinktomorrow\Chief\Urls\Field;
6 6
 
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
         // Push update to homepage setting value
21 21
         // TODO: we should just fetch the homepages and push that instead...
22
-        UrlRecord::getByModel($model)->reject(function ($record) {
22
+        UrlRecord::getByModel($model)->reject(function($record) {
23 23
             return ($record->isRedirect() || !$record->isHomepage());
24
-        })->each(function ($record) {
24
+        })->each(function($record) {
25 25
             app(ChangeHomepage::class)->onUrlChanged($record);
26 26
         });
27 27
     }
Please login to merge, or discard this patch.
src/Urls/Field/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/Urls/Field/UrlSlugField.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         return $this->fullUrl
44 44
             ? $this->fullUrl
45
-            : $this->prepend . $this->getValue();
45
+            : $this->prepend.$this->getValue();
46 46
     }
47 47
 
48 48
     public function setFullUrl(string $fullUrl)
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             'baseUrlSegment' => $this->baseUrlSegment,
95 95
             'hint'           => null, // Hint placeholder to show url hint when it already exists
96 96
             'is_homepage'    => ($this->getValue() === '/'),
97
-            'show'           => !!$this->getValue(),// show input field or not
97
+            'show'           => !!$this->getValue(), // show input field or not
98 98
         ];
99 99
     }
100 100
 }
Please login to merge, or discard this patch.
src/Urls/UrlHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
     public static function modelsByType(array $types, Model $ignoredModel = null, bool $online = true)
91 91
     {
92
-        $models = chiefMemoize('all-online-models-' . implode('_', $types), function () use ($types, $online) {
92
+        $models = chiefMemoize('all-online-models-'.implode('_', $types), function() use ($types, $online) {
93 93
             $builder = UrlRecord::whereNull('redirect_id')
94 94
                 ->select('model_type', 'model_id')
95 95
                 ->groupBy('model_type', 'model_id');
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
                 $builder->whereIn('model_type', $types);
99 99
             }
100 100
 
101
-            return $builder->get()->mapToGroups(function ($record) {
101
+            return $builder->get()->mapToGroups(function($record) {
102 102
                 return [$record->model_type => $record->model_id];
103
-            })->map(function ($record, $key) {
103
+            })->map(function($record, $key) {
104 104
                 return Morphables::instance($key)->find($record->toArray());
105
-            })->map->reject(function ($model) use ($online) {
105
+            })->map->reject(function($model) use ($online) {
106 106
                 if ($online) {
107 107
                     return is_null($model) || (public_method_exists($model, 'isPublished') && !$model->isPublished());
108 108
                 } // Invalid references to archived or removed models where url record still exists.
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         });
113 113
 
114 114
         if ($ignoredModel) {
115
-            $models = $models->reject(function ($model) use ($ignoredModel) {
115
+            $models = $models->reject(function($model) use ($ignoredModel) {
116 116
                 return (get_class($model) === get_class($ignoredModel) && $model->id === $ignoredModel->id);
117 117
             });
118 118
         }
Please login to merge, or discard this patch.
src/Media/Application/AbstractMediaFieldHandler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
             return $filename;
141 141
         }
142 142
 
143
-        $extension = substr($filename, strrpos($filename, '.') + 1);
143
+        $extension = substr($filename, strrpos($filename, '.')+1);
144 144
         $filename = substr($filename, 0, strrpos($filename, '.'));
145 145
 
146
-        return Str::slug($filename) . '.' . $extension;
146
+        return Str::slug($filename).'.'.$extension;
147 147
     }
148 148
 
149 149
     protected function sort(HasAsset $model, MediaField $field, array $input)
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
         $values = isset($fileIdInput[$key])
170 170
             ? $fileIdInput[$key]
171 171
             : (
172
-                isset($fileIdInput['files-' . $key])
173
-                ? $fileIdInput['files-' . $key]
172
+                isset($fileIdInput['files-'.$key])
173
+                ? $fileIdInput['files-'.$key]
174 174
                 : ''
175 175
             );
176 176
 
Please login to merge, or discard this patch.