@@ -53,7 +53,7 @@ |
||
| 53 | 53 | { |
| 54 | 54 | foreach ($flatReferences as $locale => $flatReferenceString) { |
| 55 | 55 | if (!$flatReferenceString) { |
| 56 | - throw new \InvalidArgumentException('Homepage setting value cannot be empty. Value for locale ' . $locale . ' is missing.'); |
|
| 56 | + throw new \InvalidArgumentException('Homepage setting value cannot be empty. Value for locale '.$locale.' is missing.'); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | // prepend the name with the expected trans.<locale>. string |
| 28 | 28 | $localizedAttr = (false !== strpos($attr, ':locale')) |
| 29 | 29 | ? str_replace(':locale', $locale, $attr) |
| 30 | - : 'trans.' . $locale . '.' . $attr; |
|
| 30 | + : 'trans.'.$locale.'.'.$attr; |
|
| 31 | 31 | |
| 32 | 32 | $localizedAttr = $this->replaceBracketsByDots($localizedAttr); |
| 33 | 33 | |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function influenceByPayload(array $data) |
| 51 | 51 | { |
| 52 | - if (! isset($data['trans'])) { |
|
| 52 | + if (!isset($data['trans'])) { |
|
| 53 | 53 | return $this; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Remove locales that are considered empty in the request payload |
| 57 | 57 | foreach ($data['trans'] as $locale => $values) { |
| 58 | - if ($locale == $this->defaultLocale || ! is_array_empty($values)) { |
|
| 58 | + if ($locale == $this->defaultLocale || !is_array_empty($values)) { |
|
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -18,7 +18,7 @@ discard block |
||
| 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 | |
@@ -60,10 +60,10 @@ discard block |
||
| 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,7 +76,7 @@ discard block |
||
| 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 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 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 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | if (is_string($file)) { |
| 53 | 53 | $image_name = json_decode($file)->output->name; |
| 54 | 54 | $asset = $this->addAsset(json_decode($file)->output->image, $type, $locale, $image_name, $model); |
| 55 | - } else { |
|
| 55 | + }else { |
|
| 56 | 56 | $image_name = $file->getClientOriginalName(); |
| 57 | 57 | $asset = $this->addAsset($file, $type, $locale, $image_name, $model); |
| 58 | 58 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | if (is_string($file)) { |
| 77 | 77 | $asset = AssetUploader::uploadFromBase64($file, $filename); |
| 78 | - } else { |
|
| 78 | + }else { |
|
| 79 | 79 | $asset = AssetUploader::upload($file, $filename); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | private function sluggifyFilename($filename): string |
| 141 | 141 | { |
| 142 | - $extension = substr($filename, strrpos($filename, '.') + 1); |
|
| 142 | + $extension = substr($filename, strrpos($filename, '.')+1); |
|
| 143 | 143 | $filename = substr($filename, 0, strrpos($filename, '.')); |
| 144 | - $filename = str_slug($filename) . '.' . $extension; |
|
| 144 | + $filename = str_slug($filename).'.'.$extension; |
|
| 145 | 145 | |
| 146 | 146 | return $filename; |
| 147 | 147 | } |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | if ($file instanceof UploadedFile && !$file->isValid()) { |
| 158 | 158 | if ($file->getError() == UPLOAD_ERR_INI_SIZE) { |
| 159 | 159 | throw new FileTooBigException( |
| 160 | - 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' . |
|
| 161 | - 'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' . |
|
| 162 | - 'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB' |
|
| 160 | + 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '. |
|
| 161 | + 'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '. |
|
| 162 | + 'post_max_size: '.(int)(ini_get('post_max_size')).'MB' |
|
| 163 | 163 | ); |
| 164 | 164 | } |
| 165 | 165 | } |
@@ -174,16 +174,16 @@ discard block |
||
| 174 | 174 | foreach ($files_by_type as $type => $files) { |
| 175 | 175 | foreach ($files as $locale => $_files) { |
| 176 | 176 | if (!in_array($locale, config('translatable.locales'))) { |
| 177 | - throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale [' . implode(',', config('translatable.locales', [])). ']. Instead [' . $locale . '] is given.'); |
|
| 177 | + throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale ['.implode(',', config('translatable.locales', [])).']. Instead ['.$locale.'] is given.'); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (!is_array($_files)) { |
| 181 | - throw new \InvalidArgumentException('A valid files entry should be an array of files, key with either [new, replace or delete]. Instead a ' . gettype($_files) . ' is given.'); |
|
| 181 | + throw new \InvalidArgumentException('A valid files entry should be an array of files, key with either [new, replace or delete]. Instead a '.gettype($_files).' is given.'); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | foreach ($_files as $action => $file) { |
| 185 | 185 | if (!in_array($action, $actions)) { |
| 186 | - throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead ' . $action . ' is given.'); |
|
| 186 | + throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.'); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | foreach ($files_order_by_type as $type => $fileIdsCollection) { |
| 193 | 193 | foreach ($fileIdsCollection as $locale => $commaSeparatedFileIds) { |
| 194 | 194 | if (!in_array($locale, config('translatable.locales'))) { |
| 195 | - throw new \InvalidArgumentException('Corrupt file payload. key for the file order is expected to be a valid locale [' . implode(',', config('translatable.locales', [])). ']. Instead [' . $locale . '] is given.'); |
|
| 195 | + throw new \InvalidArgumentException('Corrupt file payload. key for the file order is expected to be a valid locale ['.implode(',', config('translatable.locales', [])).']. Instead ['.$locale.'] is given.'); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $builder->orderBy('updated_at', 'DESC'); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return $builder->get()->map(function ($model) { |
|
| 83 | + return $builder->get()->map(function($model) { |
|
| 84 | 84 | return (new static($this->registration))->manage($model); |
| 85 | 85 | }); |
| 86 | 86 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | public function guard($verb): Manager |
| 150 | 150 | { |
| 151 | - if (! $this->can($verb)) { |
|
| 151 | + if (!$this->can($verb)) { |
|
| 152 | 152 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $fields = $this->fields(); |
| 172 | 172 | |
| 173 | 173 | foreach ($this->assistants() as $assistant) { |
| 174 | - if (! method_exists($assistant, 'fields')) { |
|
| 174 | + if (!method_exists($assistant, 'fields')) { |
|
| 175 | 175 | continue; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Thinktomorrow\Chief\HealthMonitor\Notifiers; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Thinktomorrow\Chief\HealthMonitor\Checks; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Thinktomorrow\Chief\HealthMonitor\Notifiers; |
| 6 | 6 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public static function allOnlineModels(bool $onlySingles = false, Model $ignoredModel = null): array |
| 21 | 21 | { |
| 22 | - return chiefMemoize('all-online-models', function () use ($onlySingles, $ignoredModel) { |
|
| 22 | + return chiefMemoize('all-online-models', function() use ($onlySingles, $ignoredModel) { |
|
| 23 | 23 | $builder = UrlRecord::whereNull('redirect_id') |
| 24 | 24 | ->select('model_type', 'model_id') |
| 25 | 25 | ->groupBy('model_type', 'model_id'); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if ($ignoredModel) { |
| 32 | - $builder->whereNotIn('id', function ($query) use ($ignoredModel) { |
|
| 32 | + $builder->whereNotIn('id', function($query) use ($ignoredModel) { |
|
| 33 | 33 | $query->select('id') |
| 34 | 34 | ->from('chief_urls') |
| 35 | 35 | ->where('model_type', '=', $ignoredModel->getMorphClass()) |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | }); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $liveUrlRecords = $builder->get()->mapToGroups(function ($record) { |
|
| 40 | + $liveUrlRecords = $builder->get()->mapToGroups(function($record) { |
|
| 41 | 41 | return [$record->model_type => $record->model_id]; |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | 44 | // Get model for each of these records... |
| 45 | - $models = $liveUrlRecords->map(function ($record, $key) { |
|
| 45 | + $models = $liveUrlRecords->map(function($record, $key) { |
|
| 46 | 46 | return Morphables::instance($key)->find($record->toArray()); |
| 47 | - })->map->reject(function ($model) { |
|
| 47 | + })->map->reject(function($model) { |
|
| 48 | 48 | // Invalid references to archived or removed models where url record still exists. |
| 49 | 49 | return is_null($model) || !$model->isPublished(); |
| 50 | 50 | })->flatten(); |