Passed
Push — ft/urls ( e40d31...cdb8a8 )
by Ben
37:03
created
src/PageBuilder/PresentSections.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             $this->addModelToCollection($i, $child);
79 79
         }
80 80
 
81
-        return $this->sets->values()->map(function (ViewableContract $child) {
81
+        return $this->sets->values()->map(function(ViewableContract $child) {
82 82
             return ($this->withSnippets && method_exists($child, 'withSnippets'))
83 83
                 ? $child->withSnippets()->setViewParent($this->parent)->renderView()
84 84
                 : $child->setViewParent($this->parent)->renderView();
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     {
96 96
         // Only published pages you fool!
97 97
         // TODO: check for assistant instead of method existence
98
-        if (method_exists($model, 'isPublished') && ! $model->isPublished()) {
98
+        if (method_exists($model, 'isPublished') && !$model->isPublished()) {
99 99
             return;
100 100
         }
101 101
 
Please login to merge, or discard this patch.
src/Urls/UrlSlugFields.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 
40 40
         // Add description to wildcard field only when there are locale values.
41 41
         $wildCardField->label('Default link')
42
-                      ->description('Standaard link die altijd van toepassing is indien er geen taalspecifieke link voorhanden is. Laat deze leeg indien je deze link in bepaalde talen niet wilt beschikbaar maken.');
42
+                        ->description('Standaard link die altijd van toepassing is indien er geen taalspecifieke link voorhanden is. Laat deze leeg indien je deze link in bepaalde talen niet wilt beschikbaar maken.');
43 43
 
44 44
         foreach ($locales as $locale) {
45 45
             $fields['url-slugs.' . $locale] = UrlSlugField::make('url-slugs.' . $locale)
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
             ->label('')
36 36
         ]);
37 37
 
38
-        if (count($locales) < 2) return $fields;
38
+        if (count($locales) < 2) {
39
+            return $fields;
40
+        }
39 41
 
40 42
         // Add description to wildcard field only when there are locale values.
41 43
         $wildCardField->label('Default link')
@@ -71,7 +73,9 @@  discard block
 block discarded – undo
71 73
                 continue;
72 74
             }
73 75
 
74
-            if(!isset($fields['url-slugs.'.$record->locale])) continue;
76
+            if(!isset($fields['url-slugs.'.$record->locale])) {
77
+                continue;
78
+            }
75 79
 
76 80
             $fields['url-slugs.'.$record->locale]
77 81
                 ->setUrlRecord($record)
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $array = [];
28 28
 
29
-        foreach($this->all() as $field) {
29
+        foreach ($this->all() as $field) {
30 30
             $array[] = $field->toArray();
31 31
         }
32 32
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
     private static function initEmptyFields(array $locales, ProvidesUrl $model): self
42 42
     {
43 43
         // Add wildcard field as default
44
-        $fields = new static([ $wildCardField = UrlSlugField::make('url-slugs.' . UrlAssistant::WILDCARD)
45
-            ->name('url-slugs[' . UrlAssistant::WILDCARD . ']')
44
+        $fields = new static([$wildCardField = UrlSlugField::make('url-slugs.'.UrlAssistant::WILDCARD)
45
+            ->name('url-slugs['.UrlAssistant::WILDCARD.']')
46 46
             ->label('')
47 47
         ]);
48 48
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
                       ->description('Standaard link die altijd van toepassing is indien er geen taalspecifieke link voorhanden is. Laat deze leeg indien je deze link in bepaalde talen niet wilt beschikbaar maken.');
54 54
 
55 55
         foreach ($locales as $locale) {
56
-            $fields['url-slugs.' . $locale] = UrlSlugField::make('url-slugs.' . $locale)
56
+            $fields['url-slugs.'.$locale] = UrlSlugField::make('url-slugs.'.$locale)
57 57
                                                 ->setBaseUrlSegment($model->baseUrlSegment($locale))
58
-                                                ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)) .'/')
59
-                                                ->name('url-slugs[' . $locale . ']')
60
-                                                ->label($locale . ' link');
58
+                                                ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)).'/')
59
+                                                ->name('url-slugs['.$locale.']')
60
+                                                ->label($locale.' link');
61 61
         }
62 62
 
63 63
         return $fields;
@@ -69,25 +69,25 @@  discard block
 block discarded – undo
69 69
      */
70 70
     private static function fillWithExistingValues(ProvidesUrl $model, self $fields): void
71 71
     {
72
-        $records = MemoizedUrlRecord::getByModel($model)->reject(function ($record) {
72
+        $records = MemoizedUrlRecord::getByModel($model)->reject(function($record) {
73 73
             return $record->isRedirect();
74 74
         })->sortBy('locale');
75 75
 
76 76
         foreach ($records as $record) {
77 77
 
78 78
             if ($record->isManagedAsWildCard()) {
79
-                $fields['url-slugs.' . UrlAssistant::WILDCARD]
79
+                $fields['url-slugs.'.UrlAssistant::WILDCARD]
80 80
                     ->setUrlRecord($record)
81 81
                     ->setBaseUrlSegment($model->baseUrlSegment($record->locale));
82 82
                 continue;
83 83
             }
84 84
 
85
-            if(!isset($fields['url-slugs.'.$record->locale])) continue;
85
+            if (!isset($fields['url-slugs.'.$record->locale])) continue;
86 86
 
87 87
             $fields['url-slugs.'.$record->locale]
88 88
                 ->setUrlRecord($record)
89 89
                 ->setBaseUrlSegment($model->baseUrlSegment($record->locale))
90
-                ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) .'/');
90
+                ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).'/');
91 91
         }
92 92
     }
93 93
 }
94 94
\ No newline at end of file
Please login to merge, or discard this patch.
src/Urls/ValidationRules/UniqueUrlSlugRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      */
27 27
     public function passes($attribute, $slugs)
28 28
     {
29
-        foreach($slugs as $locale => $slug) {
29
+        foreach ($slugs as $locale => $slug) {
30 30
             if ($locale == '_all_') {
31 31
                 $locale = null;
32 32
             }
Please login to merge, or discard this patch.
src/Urls/MemoizedUrlRecord.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
 {
9 9
     public static function findByModel(Model $model, string $locale = null): UrlRecord
10 10
     {
11
-        return chiefMemoize('url-records-find-by-model', function($model, $locale = null){
11
+        return chiefMemoize('url-records-find-by-model', function($model, $locale = null) {
12 12
             return parent::findByModel($model, $locale);
13 13
         }, [$model, $locale]);
14 14
     }
15 15
 
16 16
     public static function getByModel(Model $model)
17 17
     {
18
-        return chiefMemoize('url-records-get-by-model', function($model){
18
+        return chiefMemoize('url-records-get-by-model', function($model) {
19 19
             return parent::getByModel($model);
20 20
         }, [$model]);
21 21
     }
Please login to merge, or discard this patch.
src/Urls/UrlRecord.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
     public static function getByModel(Model $model)
64 64
     {
65 65
         return static::where('model_type', $model->getMorphClass())
66
-                     ->where('model_id', $model->id)
67
-                     ->get();
66
+                        ->where('model_id', $model->id)
67
+                        ->get();
68 68
     }
69 69
 
70 70
     public function replace(array $values): UrlRecord
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
         if($ignoredModel){
116 116
             $builder->whereNotIn('id', function($query) use($ignoredModel){
117 117
                 $query->select('id')
118
-                      ->from('chief_urls')
119
-                      ->where('model_type', '=', $ignoredModel->getMorphClass())
120
-                      ->where('model_id', '=', $ignoredModel->id);
118
+                        ->from('chief_urls')
119
+                        ->where('model_type', '=', $ignoredModel->getMorphClass())
120
+                        ->where('model_id', '=', $ignoredModel->id);
121 121
             });
122 122
         }
123 123
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
     public static function findBySlug(string $slug, string $locale): UrlRecord
23 23
     {
24 24
         // Clear the input from any trailing slashes.
25
-        if($slug != '/'){ $slug = trim($slug,'/'); }
25
+        if ($slug != '/') { $slug = trim($slug, '/'); }
26 26
 
27 27
         $record = static::where('slug', $slug)
28 28
                         ->where('locale', $locale)
29 29
                         ->orderBy('redirect_id', 'ASC')
30 30
                         ->first();
31 31
 
32
-        if(!$record){
32
+        if (!$record) {
33 33
             throw new UrlRecordNotFound('No url record found by slug ['.$slug.'] for locale ['.$locale.'].');
34 34
         }
35 35
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             ->orderBy('redirect_id', 'ASC')
54 54
             ->first();
55 55
 
56
-        if(!$record){
56
+        if (!$record) {
57 57
             throw new UrlRecordNotFound('No url record found for model ['.$model->getMorphClass().'@'.$model->id.'] for locale ['.$locale.'].');
58 58
         }
59 59
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function redirectTo(self $record = null): ?UrlRecord
85 85
     {
86
-        if(!$record){
86
+        if (!$record) {
87 87
             return $this->isRedirect() ? static::find($this->redirect_id) : null;
88 88
         }
89 89
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $builder = static::where('locale', $locale)
113 113
                         ->where('slug', $slug);
114 114
 
115
-        if($ignoredModel){
115
+        if ($ignoredModel) {
116 116
             $builder->whereNotIn('id', function($query) use($ignoredModel){
117 117
                 $query->select('id')
118 118
                       ->from('chief_urls')
Please login to merge, or discard this patch.
src/Urls/ChiefResponse.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,41 +14,41 @@
 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) $request = request();
18
+        if (!$locale) $locale = app()->getLocale();
19 19
 
20 20
         return static::fromSlug($request->path(), $locale);
21 21
     }
22 22
 
23 23
     public static function fromSlug(string $slug, $locale = null)
24 24
     {
25
-        if(!$locale) $locale = app()->getLocale();
25
+        if (!$locale) $locale = app()->getLocale();
26 26
 
27
-        try{
27
+        try {
28 28
             $urlRecord = UrlRecord::findBySlug($slug, $locale);
29 29
 
30 30
             $model = Morphables::instance($urlRecord->model_type)->find($urlRecord->model_id);
31 31
 
32
-            if($urlRecord->isRedirect()){
32
+            if ($urlRecord->isRedirect()) {
33 33
                 return static::createRedirect($model->url($locale));
34 34
             }
35 35
 
36
-            if(method_exists($model, 'isPublished') && ! $model->isPublished()){
36
+            if (method_exists($model, 'isPublished') && !$model->isPublished()) {
37 37
 
38 38
                 /** When admin is logged in and this request is in preview mode, we allow the view */
39
-                if( ! PreviewMode::fromRequest()->check()){
40
-                    throw new NotFoundHttpException('Model found for request ['. $slug .'] but it is not published.');
39
+                if (!PreviewMode::fromRequest()->check()) {
40
+                    throw new NotFoundHttpException('Model found for request ['.$slug.'] but it is not published.');
41 41
                 }
42 42
             }
43 43
 
44 44
             return new static($model->renderView(), 200);
45 45
         }
46
-        catch(UrlRecordNotFound | NotFoundMorphKey $e)
46
+        catch (UrlRecordNotFound | NotFoundMorphKey $e)
47 47
         {
48
-            if(config('thinktomorrow.chief.strict')){ throw $e; }
48
+            if (config('thinktomorrow.chief.strict')) { throw $e; }
49 49
         }
50 50
 
51
-        throw new NotFoundHttpException('No url or model found for request ['. $slug .'] for locale ['.$locale.'].');
51
+        throw new NotFoundHttpException('No url or model found for request ['.$slug.'] for locale ['.$locale.'].');
52 52
     }
53 53
 
54 54
     private static function createRedirect(string $url)
Please login to merge, or discard this 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 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@
 block discarded – undo
31 31
 
32 32
     private function rawSlugValue(): string
33 33
     {
34
-        if(!$this->urlRecord) return '';
34
+        if (!$this->urlRecord) return '';
35 35
 
36 36
         $slug = $this->urlRecord->slug;
37 37
 
38
-        if($this->startsWithBaseUrlSegment($slug)){
38
+        if ($this->startsWithBaseUrlSegment($slug)) {
39 39
             $slug = trim(substr($slug, strlen($this->baseUrlSegment)), '/');
40 40
         }
41 41
 
Please login to merge, or discard this 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/Urls/SaveUrlSlugs.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
     {
22 22
         $this->existingRecords = UrlRecord::getByModel($this->model);
23 23
 
24
-        foreach($slugs as $locale => $slug){
24
+        foreach ($slugs as $locale => $slug) {
25 25
 
26
-            if($locale == UrlAssistant::WILDCARD){
26
+            if ($locale == UrlAssistant::WILDCARD) {
27 27
 
28 28
                 $this->saveWildcardSlug($this->remainingLocales($slugs), $slug);
29 29
                 continue;
30 30
             }
31 31
 
32
-            if(!$slug){
32
+            if (!$slug) {
33 33
                 $this->deleteRecord($locale);
34 34
                 continue;
35 35
             }
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
      */
47 47
     private function saveWildcardSlug(array $locales, ?string $slug)
48 48
     {
49
-        foreach($locales as $locale)
49
+        foreach ($locales as $locale)
50 50
         {
51
-            if(!$slug) {
51
+            if (!$slug) {
52 52
                 $this->deleteRecord($locale, true);
53 53
                 continue;
54 54
             }
@@ -77,20 +77,20 @@  discard block
 block discarded – undo
77 77
         $this->deleteIdenticalRedirects($this->existingRecords, $locale, $slug, $savingAsWildcard);
78 78
 
79 79
         // If slug entry is left empty, all existing records will be deleted
80
-        if(!$slug){
80
+        if (!$slug) {
81 81
             $recordsWithSameLocale->filter(function($existingRecord) use($savingAsWildcard){
82 82
                 return ($existingRecord->isManagedAsWildcard() === $savingAsWildcard);
83
-            })->each(function($existingRecord){
83
+            })->each(function($existingRecord) {
84 84
                 $existingRecord->delete();
85 85
             });
86 86
         }
87
-        elseif($recordsWithSameLocale->isEmpty()){
87
+        elseif ($recordsWithSameLocale->isEmpty()) {
88 88
             $this->createRecord($locale, $slug, $savingAsWildcard);
89 89
         }
90
-        else{
90
+        else {
91 91
             // Only replace the existing records that differ from the current passed slugs
92 92
             $recordsWithSameLocale->each(function($existingRecord) use($slug, $savingAsWildcard){
93
-                if($existingRecord->slug != $slug){
93
+                if ($existingRecord->slug != $slug) {
94 94
                     $existingRecord->replace(['slug' => $slug, 'managed_as_wildcard' => $savingAsWildcard]);
95 95
                 }
96 96
             });
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
      */
117 117
     private function deleteIdenticalRedirects($existingRecords, $locale, $slug, bool $managedAsWildcard = false): void
118 118
     {
119
-        $existingRecords->filter(function ($record) use ($locale, $managedAsWildcard) {
119
+        $existingRecords->filter(function($record) use ($locale, $managedAsWildcard) {
120 120
             return (
121 121
                 $record->locale == $locale &&
122 122
                 $managedAsWildcard === $record->isManagedAsWildcard() &&
123 123
                 $record->isRedirect()
124 124
             );
125
-        })->each(function ($existingRecord) use ($slug) {
125
+        })->each(function($existingRecord) use ($slug) {
126 126
             if ($existingRecord->slug == $slug) {
127 127
                 $existingRecord->delete();
128 128
             }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
         foreach ($slugs as $locale => $slug) {
143 143
             if ($slug && $locale !== UrlAssistant::WILDCARD) {
144
-                if(false !== ($index = array_search($locale, $remainingLocales)))
144
+                if (false !== ($index = array_search($locale, $remainingLocales)))
145 145
                 {
146 146
                     unset($remainingLocales[$index]);
147 147
                 }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     private function prependBaseUrlSegment(string $slug, $locale): string
160 160
     {
161
-        $slugWithBaseSegment = $this->model->baseUrlSegment($locale) . '/' . $slug;
161
+        $slugWithBaseSegment = $this->model->baseUrlSegment($locale).'/'.$slug;
162 162
         $slugWithBaseSegment = trim($slugWithBaseSegment, '/');
163 163
 
164 164
         // If slug with base segment is empty string, it means that the passed slug was probably a "/" character.
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,11 +83,9 @@
 block discarded – undo
83 83
             })->each(function($existingRecord){
84 84
                 $existingRecord->delete();
85 85
             });
86
-        }
87
-        elseif($recordsWithSameLocale->isEmpty()){
86
+        } elseif($recordsWithSameLocale->isEmpty()){
88 87
             $this->createRecord($locale, $slug, $savingAsWildcard);
89
-        }
90
-        else{
88
+        } else{
91 89
             // Only replace the existing records that differ from the current passed slugs
92 90
             $recordsWithSameLocale->each(function($existingRecord) use($slug, $savingAsWildcard){
93 91
                 if($existingRecord->slug != $slug){
Please login to merge, or discard this patch.
src/Management/Application/StoringAndUpdatingFields.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 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)) continue;
24 24
 
25 25
             // Media fields are treated separately
26 26
             if ($field->ofType(FieldType::MEDIA, FieldType::DOCUMENT)) {
27
-                if (! isset($this->saveMethods['_files'])) {
27
+                if (!isset($this->saveMethods['_files'])) {
28 28
                     $this->saveMethods['_files'] = ['field' => new Fields([$field]), 'method' => 'uploadMedia'];
29 29
                     continue;
30 30
                 }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             }
35 35
 
36 36
             // Custom set methods - default is the generic setField() method.
37
-            $methodName = 'set'. ucfirst(camel_case($field->key())) . 'Field';
37
+            $methodName = 'set'.ucfirst(camel_case($field->key())).'Field';
38 38
             (method_exists($manager, $methodName))
39 39
                 ? $manager->$methodName($field, $request)
40 40
                 : $manager->setField($field, $request);
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 
47 47
     protected function detectCustomSaveMethods(Manager $manager, Field $field): bool
48 48
     {
49
-        $saveMethodName = 'save'. ucfirst(camel_case($field->key())) . 'Field';
49
+        $saveMethodName = 'save'.ucfirst(camel_case($field->key())).'Field';
50 50
 
51 51
         // Custom save method on assistant
52
-        foreach($manager->assistants() as $assistant)
52
+        foreach ($manager->assistants() as $assistant)
53 53
         {
54 54
             if (method_exists($assistant, $saveMethodName)) {
55 55
                 $this->saveAssistantMethods[$field->key] = ['field' => $field, 'method' => $saveMethodName, 'assistant' => $assistant];
Please login to merge, or discard this 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.