@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | return $filename; |
142 | 142 | } |
143 | 143 | |
144 | - $extension = substr($filename, strrpos($filename, '.') + 1); |
|
144 | + $extension = substr($filename, strrpos($filename, '.')+1); |
|
145 | 145 | $filename = substr($filename, 0, strrpos($filename, '.')); |
146 | 146 | |
147 | - return Str::slug($filename) . '.' . $extension; |
|
147 | + return Str::slug($filename).'.'.$extension; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | protected function sort(HasAsset $model, MediaField $field, Request $request) |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | $values = isset($fileIdInput[$key]) |
171 | 171 | ? $fileIdInput[$key] |
172 | 172 | : ( |
173 | - isset($fileIdInput['files-' . $key]) |
|
174 | - ? $fileIdInput['files-' . $key] |
|
173 | + isset($fileIdInput['files-'.$key]) |
|
174 | + ? $fileIdInput['files-'.$key] |
|
175 | 175 | : '' |
176 | 176 | ); |
177 | 177 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | $value = is_null($value) ? [] : (is_array($value) ? $value : json_decode($value, true)); |
19 | 19 | |
20 | - return new static((array) $value); |
|
20 | + return new static((array)$value); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function has(string $key): bool |
@@ -37,7 +37,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $files = $this->filesystem->files($directory); |
30 | 30 | |
31 | - return collect($files)->filter(function ($file) { |
|
31 | + return collect($files)->filter(function($file) { |
|
32 | 32 | return (Str::startsWith($file->getFileName(), 'sitemap-') && Str::endsWith($file->getFileName(), '.xml')); |
33 | 33 | }); |
34 | 34 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $models = UrlRecord::allOnlineModels($locale); |
77 | 77 | |
78 | 78 | $this->urls = $models |
79 | - ->reject(function (ProvidesUrl $model) use ($locale) { |
|
79 | + ->reject(function(ProvidesUrl $model) use ($locale) { |
|
80 | 80 | // In case the url is not found or present for given locale. |
81 | 81 | return !$model->url($locale); |
82 | 82 | }) |
83 | - ->map(function (ProvidesUrl $model) use ($locale, $alternateLocales) { |
|
83 | + ->map(function(ProvidesUrl $model) use ($locale, $alternateLocales) { |
|
84 | 84 | $url = $model->url($locale); |
85 | 85 | |
86 | 86 | $alternateUrls = []; |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | { |
102 | 102 | $pool = new Pool($this->httpClient, $this->crawlableUrlGenerator(), [ |
103 | 103 | 'concurrency' => 5, |
104 | - 'fulfilled' => function (Response $response, $index) { |
|
104 | + 'fulfilled' => function(Response $response, $index) { |
|
105 | 105 | if ($response->getStatusCode() !== \Symfony\Component\HttpFoundation\Response::HTTP_OK) { |
106 | 106 | unset($this->urls[$index]); |
107 | 107 | } |
108 | 108 | }, |
109 | - 'rejected' => function (RequestException $reason, $index) { |
|
109 | + 'rejected' => function(RequestException $reason, $index) { |
|
110 | 110 | unset($this->urls[$index]); |
111 | 111 | }, |
112 | 112 | ]); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | public function route($verb): ?string |
36 | 36 | { |
37 | - if($this->manager->hasExistingModel()) { |
|
37 | + if ($this->manager->hasExistingModel()) { |
|
38 | 38 | $routes = [ |
39 | 39 | 'check' => route('chief.back.assistants.url.check', [ |
40 | 40 | $this->manager->details()->key, |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | // Push update to homepage setting value |
80 | 80 | // TODO: we should just fetch the homepages and push that instead... |
81 | - UrlRecord::getByModel($this->manager->existingModel())->reject(function ($record) { |
|
81 | + UrlRecord::getByModel($this->manager->existingModel())->reject(function($record) { |
|
82 | 82 | return ($record->isRedirect() || !$record->isHomepage()); |
83 | - })->each(function ($record) { |
|
83 | + })->each(function($record) { |
|
84 | 84 | app(ChangeHomepage::class)->onUrlChanged($record); |
85 | 85 | }); |
86 | 86 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | private function validateModel() |
94 | 94 | { |
95 | 95 | if (!$this->manager->existingModel() instanceof ProvidesUrl) { |
96 | - throw new \Exception('UrlAssistant requires the model interfaced by ' . ProvidesUrl::class . '.'); |
|
96 | + throw new \Exception('UrlAssistant requires the model interfaced by '.ProvidesUrl::class.'.'); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | return $this->indexPagination($builder); |
89 | 89 | } |
90 | 90 | |
91 | - return $builder->get()->map(function ($model) { |
|
91 | + return $builder->get()->map(function($model) { |
|
92 | 92 | return (new static($this->registration))->manage($model); |
93 | 93 | }); |
94 | 94 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | { |
117 | 117 | $paginator = $builder->paginate($this->pageCount); |
118 | 118 | |
119 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
119 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
120 | 120 | return (new static($this->registration))->manage($model); |
121 | 121 | }); |
122 | 122 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | public function editFields(): Fields |
234 | 234 | { |
235 | - return $this->fieldsWithAssistantFields()->map(function(Field $field){ |
|
235 | + return $this->fieldsWithAssistantFields()->map(function(Field $field) { |
|
236 | 236 | return $field->model($this->model); |
237 | 237 | }); |
238 | 238 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | static::$bootedTraitMethods[$baseMethod] = []; |
326 | 326 | |
327 | 327 | foreach (class_uses_recursive($class) as $trait) { |
328 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
328 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
329 | 329 | |
330 | 330 | if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
331 | 331 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
@@ -51,8 +51,8 @@ |
||
51 | 51 | |
52 | 52 | public function editFields(): Fields |
53 | 53 | { |
54 | - return $this->fields()->map(function(Field $field){ |
|
55 | - return $field->valueResolver(function($model = null, $locale = null, $field){ |
|
54 | + return $this->fields()->map(function(Field $field) { |
|
55 | + return $field->valueResolver(function($model = null, $locale = null, $field) { |
|
56 | 56 | return $this->settings->get($field->getKey(), $locale); |
57 | 57 | }); |
58 | 58 | }); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | private function defaultEloquentValueResolver(): \Closure |
239 | 239 | { |
240 | - return function (Model $model = null, $locale = null) { |
|
240 | + return function(Model $model = null, $locale = null) { |
|
241 | 241 | if (!$model) { |
242 | 242 | return $this->value; |
243 | 243 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | return $this->isLocalized() |
392 | 392 | ? 'chief::back._formgroups.fieldgroup_translatable' |
393 | - : 'chief::back._fields.' . $this->type->get(); |
|
393 | + : 'chief::back._fields.'.$this->type->get(); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | public function viewData(array $viewData = []): Field |
@@ -406,6 +406,6 @@ discard block |
||
406 | 406 | 'model' => $this->getModel(), |
407 | 407 | 'field' => $this, |
408 | 408 | 'key' => $this->getKey(), |
409 | - ],$this->viewData); |
|
409 | + ], $this->viewData); |
|
410 | 410 | } |
411 | 411 | } |