Test Setup Failed
Push — a-simpler-manager ( 2ffb82...cdafdc )
by Ben
07:43
created
src/Site/Urls/Application/SaveUrlSlugs.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     private function saveRecord(ProvidesUrl $model, string $locale, ?string $slug, Collection $existingRecords, bool $strict = true)
44 44
     {
45 45
         // Existing ones for this locale?
46
-        $nonRedirectsWithSameLocale = $existingRecords->filter(function ($record) use ($locale) {
46
+        $nonRedirectsWithSameLocale = $existingRecords->filter(function($record) use ($locale) {
47 47
             return (
48 48
                 $record->locale == $locale &&
49 49
                 !$record->isRedirect()
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
         // If slug entry is left empty, all existing records will be deleted
54 54
         if (!$slug) {
55
-            $nonRedirectsWithSameLocale->each(function ($existingRecord) {
55
+            $nonRedirectsWithSameLocale->each(function($existingRecord) {
56 56
                 $existingRecord->delete();
57 57
             });
58 58
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         }
70 70
 
71 71
         // Only replace the existing records that differ from the current passed slugs
72
-        $nonRedirectsWithSameLocale->each(function ($existingRecord) use ($slug) {
72
+        $nonRedirectsWithSameLocale->each(function($existingRecord) use ($slug) {
73 73
             if ($existingRecord->slug != $slug) {
74 74
                 $existingRecord->replaceAndRedirect(['slug' => $slug]);
75 75
             }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $this->deleteIdenticalRedirects($sameExistingRecords, $locale, $slug);
99 99
 
100 100
         // Also delete any urls that match this locale and slug but are related to another model
101
-        if(!$this->strict) {
101
+        if (!$this->strict) {
102 102
             $this->deleteIdenticalRecords($model, $sameExistingRecords);
103 103
         }
104 104
     }
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
      */
113 113
     private function deleteIdenticalRedirects($existingRecords, $locale, $slug): void
114 114
     {
115
-        $existingRecords->filter(function ($record) use ($locale) {
115
+        $existingRecords->filter(function($record) use ($locale) {
116 116
             return (
117 117
                 $record->locale == $locale &&
118 118
                 $record->isRedirect()
119 119
             );
120
-        })->each(function ($existingRecord) use ($slug) {
120
+        })->each(function($existingRecord) use ($slug) {
121 121
             if ($existingRecord->slug == $slug) {
122 122
                 $existingRecord->delete();
123 123
             }
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
     {
129 129
         // The old homepage url should be removed since this is no longer in effect.
130 130
         // In case of any redirect to this old homepage, the last used redirect is now back in effect.
131
-        $existingRecords->reject(function ($existingRecord) use($model) {
131
+        $existingRecords->reject(function($existingRecord) use($model) {
132 132
             return (
133 133
                 $existingRecord->model_type == $model->getMorphClass() &&
134 134
                 $existingRecord->model_id == $model->id);
135
-        })->each(function ($existingRecord) {
135
+        })->each(function($existingRecord) {
136 136
 
137 137
             // TODO: if there is a redirect to this page, we'll take this one as the new url
138 138
             $existingRecord->delete();
Please login to merge, or discard this patch.
src/ManagedModels/Assistants/ManagedModelDefaults.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
     public function adminLabel(string $key, $default = null, array $replace = [])
22 22
     {
23
-        if (! ($value = data_get($this->adminLabels(), $key)) ) {
23
+        if (!($value = data_get($this->adminLabels(), $key))) {
24 24
             return $default;
25 25
         }
26 26
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     private function adminLabels(): array
37 37
     {
38
-        $singular = Str::of(static::managedModelKey())->singular()->replace('_',' ')->__toString();
38
+        $singular = Str::of(static::managedModelKey())->singular()->replace('_', ' ')->__toString();
39 39
 
40 40
         return [
41 41
             /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
              */
46 46
             'label' => $singular, // Label used to refer to the generic model
47 47
             'nav_label' => $singular, // label used in the chief navigation
48
-            'page_title' => Str::of(static::managedModelKey())->plural()->replace('_',' ')->__toString(), // Generic collection title, for example used on index
48
+            'page_title' => Str::of(static::managedModelKey())->plural()->replace('_', ' ')->__toString(), // Generic collection title, for example used on index
49 49
 
50 50
             /**
51 51
              * Instance labels
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 
63 63
     private function onlineStatusAsLabel(): string
64 64
     {
65
-        if(!$this instanceof ProvidesUrl) return '';
65
+        if (!$this instanceof ProvidesUrl) return '';
66 66
 
67 67
         if ($this->current_status === PageState::PUBLISHED) {
68
-            return '<a href="' . $this->url() . '" target="_blank"><em>online</em></a>';
68
+            return '<a href="'.$this->url().'" target="_blank"><em>online</em></a>';
69 69
         }
70 70
 
71 71
         if ($this->current_status === PageState::DRAFT) {
72
-            return '<a href="' . $this->url() . '" target="_blank" class="text-error"><em>offline</em></a>';
72
+            return '<a href="'.$this->url().'" target="_blank" class="text-error"><em>offline</em></a>';
73 73
         }
74 74
 
75 75
         if ($this->current_status === PageState::ARCHIVED) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,9 @@
 block discarded – undo
62 62
 
63 63
     private function onlineStatusAsLabel(): string
64 64
     {
65
-        if(!$this instanceof ProvidesUrl) return '';
65
+        if(!$this instanceof ProvidesUrl) {
66
+            return '';
67
+        }
66 68
 
67 69
         if ($this->current_status === PageState::PUBLISHED) {
68 70
             return '<a href="' . $this->url() . '" target="_blank"><em>online</em></a>';
Please login to merge, or discard this patch.