@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | return $this->model->__toString(); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $sourceStrings = array_map(function ($key) { |
|
| 130 | + $sourceStrings = array_map(function($key) { |
|
| 131 | 131 | $value = data_get($this->model, $key); |
| 132 | 132 | if (is_bool($value)) { |
| 133 | - $value = (int)$value; |
|
| 133 | + $value = (int) $value; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | return $value; |
| 137 | - }, (array)$from); |
|
| 137 | + }, (array) $from); |
|
| 138 | 138 | |
| 139 | 139 | return implode($sourceStrings, ' '); |
| 140 | 140 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } elseif (is_callable($method)) { |
| 163 | 163 | $slug = call_user_func($method, $source, $separator); |
| 164 | 164 | } else { |
| 165 | - throw new \UnexpectedValueException('Sluggable "method" for '.get_class($this->model).':'.$attribute.' is not callable nor null.'); |
|
| 165 | + throw new \UnexpectedValueException('Sluggable "method" for ' . get_class($this->model) . ':' . $attribute . ' is not callable nor null.'); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $len = mb_strlen($slug); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | static $slugEngines = []; |
| 193 | 193 | |
| 194 | - $key = get_class($this->model).'.'.$attribute; |
|
| 194 | + $key = get_class($this->model) . '.' . $attribute; |
|
| 195 | 195 | |
| 196 | 196 | if (!array_key_exists($key, $slugEngines)) { |
| 197 | 197 | $engine = new Slugify(); |
@@ -237,16 +237,16 @@ discard block |
||
| 237 | 237 | } elseif (is_callable($method)) { |
| 238 | 238 | $suffix = $method($slug, $separator, collect($reserved)); |
| 239 | 239 | } else { |
| 240 | - throw new \UnexpectedValueException('Sluggable "uniqueSuffix" for '.get_class($this->model).':'.$attribute.' is not null, or a closure.'); |
|
| 240 | + throw new \UnexpectedValueException('Sluggable "uniqueSuffix" for ' . get_class($this->model) . ':' . $attribute . ' is not null, or a closure.'); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - return $slug.$separator.$suffix; |
|
| 243 | + return $slug . $separator . $suffix; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | return $slug; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - throw new \UnexpectedValueException('Sluggable "reserved" for '.get_class($this->model).':'.$attribute.' is not null, an array, or a closure that returns null/array.'); |
|
| 249 | + throw new \UnexpectedValueException('Sluggable "reserved" for ' . get_class($this->model) . ':' . $attribute . ' is not null, an array, or a closure that returns null/array.'); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -302,10 +302,10 @@ discard block |
||
| 302 | 302 | } elseif (is_callable($method)) { |
| 303 | 303 | $suffix = $method($slug, $separator, $list); |
| 304 | 304 | } else { |
| 305 | - throw new \UnexpectedValueException('Sluggable "uniqueSuffix" for '.get_class($this->model).':'.$attribute.' is not null, or a closure.'); |
|
| 305 | + throw new \UnexpectedValueException('Sluggable "uniqueSuffix" for ' . get_class($this->model) . ':' . $attribute . ' is not null, or a closure.'); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - return $slug.$separator.$suffix; |
|
| 308 | + return $slug . $separator . $suffix; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | */ |
| 320 | 320 | protected function generateSuffix(string $slug, string $separator, Collection $list): string |
| 321 | 321 | { |
| 322 | - $len = strlen($slug.$separator); |
|
| 322 | + $len = strlen($slug . $separator); |
|
| 323 | 323 | |
| 324 | 324 | // If the slug already exists, but belongs to |
| 325 | 325 | // our model, return the current suffix. |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | return end($suffix); |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - $list->transform(function ($value, $key) use ($len) { |
|
| 333 | - return (int)substr($value, $len); |
|
| 332 | + $list->transform(function($value, $key) use ($len) { |
|
| 333 | + return (int) substr($value, $len); |
|
| 334 | 334 | }); |
| 335 | 335 | |
| 336 | 336 | // find the highest value and return one greater. |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | if ($config === null) { |
| 405 | 405 | $config = array_get($model->sluggable(), $attribute); |
| 406 | 406 | } elseif (!is_array($config)) { |
| 407 | - throw new \UnexpectedValueException('SlugService::createSlug expects an array or null as the fourth argument; '.gettype($config).' given.'); |
|
| 407 | + throw new \UnexpectedValueException('SlugService::createSlug expects an array or null as the fourth argument; ' . gettype($config) . ' given.'); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | $config = $instance->getConfiguration($config); |