Passed
Push — ft/urls ( cdb8a8...010a18 )
by Ben
26:40
created
src/Urls/ChiefResponse.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,15 +14,21 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public static function fromRequest(Request $request = null, $locale = null)
16 16
     {
17
-        if(!$request) $request = request();
18
-        if(!$locale) $locale = app()->getLocale();
17
+        if(!$request) {
18
+            $request = request();
19
+        }
20
+        if(!$locale) {
21
+            $locale = app()->getLocale();
22
+        }
19 23
 
20 24
         return static::fromSlug($request->path(), $locale);
21 25
     }
22 26
 
23 27
     public static function fromSlug(string $slug, $locale = null)
24 28
     {
25
-        if(!$locale) $locale = app()->getLocale();
29
+        if(!$locale) {
30
+            $locale = app()->getLocale();
31
+        }
26 32
 
27 33
         try{
28 34
             $urlRecord = UrlRecord::findBySlug($slug, $locale);
@@ -42,8 +48,7 @@  discard block
 block discarded – undo
42 48
             }
43 49
 
44 50
             return new static($model->renderView(), 200);
45
-        }
46
-        catch(UrlRecordNotFound | NotFoundMorphKey $e)
51
+        } catch(UrlRecordNotFound | NotFoundMorphKey $e)
47 52
         {
48 53
             if(config('thinktomorrow.chief.strict')){ throw $e; }
49 54
         }
Please login to merge, or discard this patch.
src/Urls/UrlSlugField.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@
 block discarded – undo
31 31
 
32 32
     private function rawSlugValue(): string
33 33
     {
34
-        if(!$this->urlRecord) return '';
34
+        if(!$this->urlRecord) {
35
+            return '';
36
+        }
35 37
 
36 38
         $slug = $this->urlRecord->slug;
37 39
 
Please login to merge, or discard this patch.
src/Management/Application/StoringAndUpdatingFields.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@
 block discarded – undo
20 20
         foreach ($manager->fieldsWithAssistantFields() as $field) {
21 21
 
22 22
             // Custom save methods
23
-            if($this->detectCustomSaveMethods($manager, $field)) continue;
23
+            if($this->detectCustomSaveMethods($manager, $field)) {
24
+                continue;
25
+            }
24 26
 
25 27
             // Media fields are treated separately
26 28
             if ($field->ofType(FieldType::MEDIA, FieldType::DOCUMENT)) {
Please login to merge, or discard this patch.
src/Management/AbstractManager.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -167,7 +167,9 @@
 block discarded – undo
167 167
         $fields = $this->fields();
168 168
 
169 169
         foreach($this->assistants() as $assistant){
170
-            if( ! method_exists($assistant, 'fields')) continue;
170
+            if( ! method_exists($assistant, 'fields')) {
171
+                continue;
172
+            }
171 173
 
172 174
             $fields = $fields->merge($assistant->fields());
173 175
         }
Please login to merge, or discard this patch.
src/Fields/Fields.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@
 block discarded – undo
24 24
 
25 25
     public function first(): ?Field
26 26
     {
27
-        if(!$this->any()) return null;
27
+        if(!$this->any()) {
28
+            return null;
29
+        }
28 30
 
29 31
         return reset($this->fields);
30 32
     }
Please login to merge, or discard this patch.
src/Concerns/Viewable/Viewable.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
     {
29 29
         try {
30 30
             return view($this->viewPath(), $this->viewData())->render();
31
-        }
32
-        catch(NotFoundView $e) {
31
+        } catch(NotFoundView $e) {
33 32
             if(config('thinktomorrow.chief.strict')){
34 33
                 throw $e;
35 34
             }
@@ -56,7 +55,9 @@  discard block
 block discarded – undo
56 55
      */
57 56
     public function viewKey(): string
58 57
     {
59
-        if(property_exists($this, 'viewKey') && isset($this->viewKey)) return $this->viewKey;
58
+        if(property_exists($this, 'viewKey') && isset($this->viewKey)) {
59
+            return $this->viewKey;
60
+        }
60 61
 
61 62
         if($this instanceof MorphableContract){
62 63
             return $this->morphKey();
Please login to merge, or discard this patch.
src/Pages/Page.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -156,14 +156,15 @@
 block discarded – undo
156 156
     /** @inheritdoc */
157 157
     public function url(string $locale = null): string
158 158
     {
159
-        if(!$locale) $locale = app()->getLocale();
159
+        if(!$locale) {
160
+            $locale = app()->getLocale();
161
+        }
160 162
 
161 163
         try{
162 164
             $slug = MemoizedUrlRecord::findByModel($this, $locale)->slug;
163 165
 
164 166
             return $this->resolveUrl($locale, [$slug]);
165
-        }
166
-        catch(UrlRecordNotFound $e)
167
+        } catch(UrlRecordNotFound $e)
167 168
         {
168 169
             return '';
169 170
         }
Please login to merge, or discard this patch.
src/Urls/SaveUrlSlugs.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,11 +59,9 @@
 block discarded – undo
59 59
             $nonRedirectsWithSameLocale->each(function($existingRecord){
60 60
                 $existingRecord->delete();
61 61
             });
62
-        }
63
-        elseif($nonRedirectsWithSameLocale->isEmpty()){
62
+        } elseif($nonRedirectsWithSameLocale->isEmpty()){
64 63
             $this->createRecord($locale, $slug);
65
-        }
66
-        else{
64
+        } else{
67 65
             // Only replace the existing records that differ from the current passed slugs
68 66
             $nonRedirectsWithSameLocale->each(function($existingRecord) use($slug){
69 67
                 if($existingRecord->slug != $slug){
Please login to merge, or discard this patch.
src/Urls/UrlSlugFields.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@
 block discarded – undo
64 64
 
65 65
         foreach ($records as $record) {
66 66
 
67
-            if(!isset($fields['url-slugs.'.$record->locale])) continue;
67
+            if(!isset($fields['url-slugs.'.$record->locale])) {
68
+                continue;
69
+            }
68 70
 
69 71
             $fields['url-slugs.'.$record->locale]
70 72
                 ->setUrlRecord($record)
Please login to merge, or discard this patch.