Test Setup Failed
Push — a-simpler-manager ( f359da...273f7a )
by Ben
07:59
created
src/Site/Urls/Controllers/RemoveRedirectController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
         $urlRecord = UrlRecord::find($id);
19 19
 
20 20
         if (!$urlRecord) {
21
-            return response()->json(['No url record found by id ' . $id], 500);
21
+            return response()->json(['No url record found by id '.$id], 500);
22 22
         }
23 23
 
24
-        if (! $urlRecord->isRedirect()) {
25
-            return response()->json(['Url with id ' . $id . ' is not a redirect'], 500);
24
+        if (!$urlRecord->isRedirect()) {
25
+            return response()->json(['Url with id '.$id.' is not a redirect'], 500);
26 26
         }
27 27
 
28 28
         $this->pointChildRedirectsToParent($urlRecord, $urlRecord->redirect_id);
Please login to merge, or discard this patch.
src/Site/Urls/Controllers/CheckLinkController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function check(Request $request)
17 17
     {
18 18
         /** @var ProvidesUrl|Model $model */
19
-        $model = (new ModelReference($request->modelClass, (int) $request->modelId))->instance();
19
+        $model = (new ModelReference($request->modelClass, (int)$request->modelId))->instance();
20 20
 
21 21
         // Trim slashes if any
22 22
         $slug = ($request->slug !== '/') ? trim($request->slug, '/') : $request->slug;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         if ($urlRecord->isRedirect()) {
41 41
             return 'Deze link bestaat reeds als redirect. Deze redirect zal bijgevolg worden verwijderd.';
42 42
         }
43
-        return 'Deze link bestaat reeds. Kies een andere of <a target="_blank" href="' . $this->editRouteOfOtherModel($urlRecord) . '">pas de andere pagina aan</a>.';
43
+        return 'Deze link bestaat reeds. Kies een andere of <a target="_blank" href="'.$this->editRouteOfOtherModel($urlRecord).'">pas de andere pagina aan</a>.';
44 44
     }
45 45
 
46 46
     private function editRouteOfOtherModel(UrlRecord $urlRecord): string
Please login to merge, or discard this patch.
src/Site/Urls/MemoizedUrlRecord.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             ->first();
37 37
 
38 38
         if (!$record) {
39
-            throw new UrlRecordNotFound('No url record found for model [' . $model->getMorphClass() . '@' . $model->id . '] for locale [' . $locale . '].');
39
+            throw new UrlRecordNotFound('No url record found for model ['.$model->getMorphClass().'@'.$model->id.'] for locale ['.$locale.'].');
40 40
         }
41 41
 
42 42
         return $record;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
     public static function getByModel(Model $model)
46 46
     {
47
-        return chiefMemoize('url-records-get-by-model', function ($model) {
47
+        return chiefMemoize('url-records-get-by-model', function($model) {
48 48
             return parent::getByModel($model);
49 49
         }, [$model]);
50 50
     }
Please login to merge, or discard this patch.
src/Site/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/Site/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\Site\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/Site/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/Site/Urls/UrlRecord.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             ->first();
38 38
 
39 39
         if (!$record) {
40
-            throw new UrlRecordNotFound('No url record found by slug [' . $slug . '] for locale [' . $locale . '].');
40
+            throw new UrlRecordNotFound('No url record found by slug ['.$slug.'] for locale ['.$locale.'].');
41 41
         }
42 42
 
43 43
         return $record;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             ->first();
62 62
 
63 63
         if (!$record) {
64
-            throw new UrlRecordNotFound('No url record found for model [' . $model->getMorphClass() . '@' . $model->id . '] for locale [' . $locale . '].');
64
+            throw new UrlRecordNotFound('No url record found for model ['.$model->getMorphClass().'@'.$model->id.'] for locale ['.$locale.'].');
65 65
         }
66 66
 
67 67
         return $record;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         }
156 156
 
157 157
         if ($ignoredModel) {
158
-            $builder->whereNotIn('id', function ($query) use ($ignoredModel) {
158
+            $builder->whereNotIn('id', function($query) use ($ignoredModel) {
159 159
                 $query->select('id')
160 160
                     ->from('chief_urls')
161 161
                     ->where('model_type', '=', $ignoredModel->getMorphClass())
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 
176 176
         // Filter out offline urls... TODO: this should be a state that is owned by the url and not the model.
177 177
         // Because of archived pages the mapping can be null so we reject them before we check for online
178
-        return $records->map(function (UrlRecord $urlRecord) {
178
+        return $records->map(function(UrlRecord $urlRecord) {
179 179
             return Morphables::instance($urlRecord->model_type)->find($urlRecord->model_id);
180
-        })->reject(function ($model) {
180
+        })->reject(function($model) {
181 181
             return $model == null;
182
-        })->reject(function (ProvidesUrl $model) {
182
+        })->reject(function(ProvidesUrl $model) {
183 183
             return (method_exists($model, 'isPublished') && !$model->isPublished());
184 184
         });
185 185
     }
Please login to merge, or discard this patch.
src/Site/Urls/ValidationRules/UniqueUrlSlugRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,6 +60,6 @@
 block discarded – undo
60 60
      */
61 61
     public function message()
62 62
     {
63
-        return 'De \'' . $this->failedDetails['slug'] . '\' link wordt in het ' . $this->failedDetails['locale'] . ' al door een andere pagina gebruikt.';
63
+        return 'De \''.$this->failedDetails['slug'].'\' link wordt in het '.$this->failedDetails['locale'].' al door een andere pagina gebruikt.';
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
src/Site/Urls/ProvidesUrl/ProvidingUrl.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
     /** @inheritdoc */
36 36
     public function baseUrlSegment(string $locale = null): string
37 37
     {
38
-        return BaseUrlSegment::find(isset(static::$baseUrlSegment) ? (array) static::$baseUrlSegment : [], $locale);
38
+        return BaseUrlSegment::find(isset(static::$baseUrlSegment) ? (array)static::$baseUrlSegment : [], $locale);
39 39
     }
40 40
 }
Please login to merge, or discard this patch.