@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function get(): string |
| 36 | 36 | { |
| 37 | - $basePath = $this->viewBasePath ? $this->viewBasePath . '.' : ''; |
|
| 37 | + $basePath = $this->viewBasePath ? $this->viewBasePath.'.' : ''; |
|
| 38 | 38 | $guessedParentViewName = $this->parent ? $this->parent->viewKey() : ''; |
| 39 | 39 | $guessedViewName = $this->viewable->viewKey(); |
| 40 | 40 | |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | foreach ($viewPaths as $viewPath) { |
| 56 | - if (! view()->exists($viewPath)) { |
|
| 56 | + if (!view()->exists($viewPath)) { |
|
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | return $viewPath; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if (! view()->exists($basePath.'show')){ |
|
| 63 | + if (!view()->exists($basePath.'show')) { |
|
| 64 | 64 | throw new NotFoundView('Viewfile not found for ['.get_class($this->viewable).']. Make sure the default view ['.$basePath.'show] exists.'); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | // If this is a '/' slug, it indicates the homepage for this locale. In this case, |
| 41 | 41 | // we wont be trimming the slash |
| 42 | - if($slug === '/') return $slug; |
|
| 42 | + if ($slug === '/') return $slug; |
|
| 43 | 43 | |
| 44 | 44 | if ($this->startsWithBaseUrlSegment($slug)) { |
| 45 | 45 | $slug = trim(substr($slug, strlen($this->baseUrlSegment)), '/'); |
@@ -39,7 +39,9 @@ |
||
| 39 | 39 | |
| 40 | 40 | // If this is a '/' slug, it indicates the homepage for this locale. In this case, |
| 41 | 41 | // we wont be trimming the slash |
| 42 | - if($slug === '/') return $slug; |
|
| 42 | + if($slug === '/') { |
|
| 43 | + return $slug; |
|
| 44 | + } |
|
| 43 | 45 | |
| 44 | 46 | if ($this->startsWithBaseUrlSegment($slug)) { |
| 45 | 47 | $slug = trim(substr($slug, strlen($this->baseUrlSegment)), '/'); |
@@ -83,12 +83,12 @@ |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $manager = new \ReflectionClass($managerClass); |
| 86 | - if (! $manager->implementsInterface(Manager::class)) { |
|
| 86 | + if (!$manager->implementsInterface(Manager::class)) { |
|
| 87 | 87 | throw new \InvalidArgumentException('Class ['.$managerClass.'] is expected to implement the ['.Manager::class.'] contract.'); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $model = new \ReflectionClass($modelClass); |
| 91 | - if (! $model->implementsInterface(ManagedModel::class)) { |
|
| 91 | + if (!$model->implementsInterface(ManagedModel::class)) { |
|
| 92 | 92 | throw new \InvalidArgumentException('Class ['.$modelClass.'] is expected to implement the ['.ManagedModel::class.'] contract.'); |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -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 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $fields[$key] = UrlSlugField::make($key) |
| 30 | 30 | ->setUrlRecord($record) |
| 31 | 31 | ->setBaseUrlSegment($model->baseUrlSegment($record->locale)) |
| 32 | - ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) . '/'); |
|
| 32 | + ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).'/'); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | return $fields; |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | $fields = new static([]); |
| 62 | 62 | |
| 63 | 63 | foreach ($locales as $locale) { |
| 64 | - $fields['url-slugs.' . $locale] = UrlSlugField::make('url-slugs.' . $locale) |
|
| 64 | + $fields['url-slugs.'.$locale] = UrlSlugField::make('url-slugs.'.$locale) |
|
| 65 | 65 | ->setBaseUrlSegment($model->baseUrlSegment($locale)) |
| 66 | - ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)) .'/') |
|
| 67 | - ->name('url-slugs[' . $locale . ']') |
|
| 66 | + ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)).'/') |
|
| 67 | + ->name('url-slugs['.$locale.']') |
|
| 68 | 68 | ->label($locale); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | private static function fillWithExistingValues(ProvidesUrl $model, self $fields): void |
| 79 | 79 | { |
| 80 | - $records = MemoizedUrlRecord::getByModel($model)->reject(function ($record) { |
|
| 80 | + $records = MemoizedUrlRecord::getByModel($model)->reject(function($record) { |
|
| 81 | 81 | return $record->isRedirect(); |
| 82 | 82 | })->sortBy('locale'); |
| 83 | 83 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $fields['url-slugs.'.$record->locale] |
| 90 | 90 | ->setUrlRecord($record) |
| 91 | 91 | ->setBaseUrlSegment($model->baseUrlSegment($record->locale)) |
| 92 | - ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) .'/'); |
|
| 92 | + ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).'/'); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | public function offsetSet($offset, $value) |
| 125 | 125 | { |
| 126 | - if (! $value instanceof Field) { |
|
| 127 | - throw new \InvalidArgumentException('Passed value must be of type ' . Field::class); |
|
| 126 | + if (!$value instanceof Field) { |
|
| 127 | + throw new \InvalidArgumentException('Passed value must be of type '.Field::class); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $this->fields[$offset] = $value; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | private function validateFields(array $fields) |
| 155 | 155 | { |
| 156 | - array_map(function (Field $field) { |
|
| 156 | + array_map(function(Field $field) { |
|
| 157 | 157 | }, $fields); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function findAll(): Collection |
| 73 | 73 | { |
| 74 | - return $this->model->published()->get()->map(function ($model) { |
|
| 74 | + return $this->model->published()->get()->map(function($model) { |
|
| 75 | 75 | return $this->managers->findByModel($model); |
| 76 | 76 | }); |
| 77 | 77 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function guard($verb): Assistant |
| 95 | 95 | { |
| 96 | - if (! $this->can($verb)) { |
|
| 96 | + if (!$this->can($verb)) { |
|
| 97 | 97 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $class = $this->isPublished() ? 'text-success' : 'text-error'; |
| 113 | 113 | |
| 114 | - $statusAsLabel = '<span class="'. $class .'"><em>' . $label . '</em></span>'; |
|
| 114 | + $statusAsLabel = '<span class="'.$class.'"><em>'.$label.'</em></span>'; |
|
| 115 | 115 | |
| 116 | - if(!$plain && $this->hasPreviewUrl()) |
|
| 116 | + if (!$plain && $this->hasPreviewUrl()) |
|
| 117 | 117 | { |
| 118 | - $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'. $statusAsLabel .'</a>'; |
|
| 118 | + $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'.$statusAsLabel.'</a>'; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return $statusAsLabel; |
@@ -125,9 +125,9 @@ |
||
| 125 | 125 | { |
| 126 | 126 | if ($this->isPublished()) { |
| 127 | 127 | return 'online'; |
| 128 | - }elseif ($this->isDraft()) { |
|
| 128 | + } elseif ($this->isDraft()) { |
|
| 129 | 129 | return 'offline'; |
| 130 | - }elseif ($this->manager->isAssistedBy('archive') && $this->manager->assistant('archive')->isArchived()) { |
|
| 130 | + } elseif ($this->manager->isAssistedBy('archive') && $this->manager->assistant('archive')->isArchived()) { |
|
| 131 | 131 | return 'gearchiveerd'; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -63,11 +63,11 @@ |
||
| 63 | 63 | |
| 64 | 64 | public static function managedModelKey(): string |
| 65 | 65 | { |
| 66 | - if(isset(static::$managedModelKey)){ |
|
| 66 | + if (isset(static::$managedModelKey)) { |
|
| 67 | 67 | return static::$managedModelKey; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class. '.'); |
|
| 70 | + throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public static function managedModelKey(): string |
| 82 | 82 | { |
| 83 | - if(isset(static::$managedModelKey)){ |
|
| 83 | + if (isset(static::$managedModelKey)) { |
|
| 84 | 84 | return static::$managedModelKey; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class. '.'); |
|
| 87 | + throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.'); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | public function flatReferenceLabel(): string |
| 125 | 125 | { |
| 126 | 126 | if ($this->exists) { |
| 127 | - $status = ! $this->isPublished() ? ' [' . $this->statusAsPlainLabel().']' : null; |
|
| 127 | + $status = !$this->isPublished() ? ' ['.$this->statusAsPlainLabel().']' : null; |
|
| 128 | 128 | |
| 129 | - return $this->title ? $this->title . $status : ''; |
|
| 129 | + return $this->title ? $this->title.$status : ''; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | return ''; |