Skip to content

Commit

Permalink
php-cs-fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cviebrock committed Nov 29, 2024
1 parent 607f2d0 commit 4db5b07
Show file tree
Hide file tree
Showing 55 changed files with 447 additions and 693 deletions.
32 changes: 14 additions & 18 deletions resources/config/sluggable.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

return [

/**
/*
* What attributes do we use to build the slug?
* This can be a single field, like "name" which will build a slug from:
*
Expand All @@ -20,15 +19,15 @@

'source' => null,

/**
/*
* The maximum length of a generated slug. Defaults to "null", which means
* no length restrictions are enforced. Set it to a positive integer if you
* want to make sure your slugs aren't too long.
*/

'maxLength' => null,

/**
/*
* If you are setting a maximum length on your slugs, you may not want the
* truncated string to split a word in half. The default setting of "true"
* will ensure this, e.g. with a maxLength of 12:
Expand All @@ -43,7 +42,7 @@

'maxLengthKeepWords' => true,

/**
/*
* If left to "null", then use the cocur/slugify package to generate the slug
* (with the separator defined below).
*
Expand All @@ -61,13 +60,11 @@

'method' => null,

/**
* Separator to use when generating slugs. Defaults to a hyphen.
*/
// Separator to use when generating slugs. Defaults to a hyphen.

'separator' => '-',

/**
/*
* Enforce uniqueness of slugs? Defaults to true.
* If a generated slug already exists, an incremental numeric
* value will be appended to the end until a unique slug is found. e.g.:
Expand All @@ -79,18 +76,18 @@

'unique' => true,

/**
/*
* If you are enforcing unique slugs, the default is to add an
* incremental value to the end of the base slug. Alternatively, you
* can change this value to a closure that accepts three parameters:
* the base slug, the separator, and a Collection of the other
* "similar" slugs. The closure should return the new unique
* suffix to append to the slug.
*/

'uniqueSuffix' => null,

/**
/*
* What is the first suffix to add to a slug to make it unique?
* For the default method of adding incremental integers, we start
* counting at 2, so the list of slugs would be, e.g.:
Expand All @@ -101,7 +98,7 @@
*/
'firstUniqueSuffix' => 2,

/**
/*
* Should we include the trashed items when generating a unique slug?
* This only applies if the softDelete property is set for the Eloquent model.
* If set to "false", then a new slug could duplicate one that exists on a trashed model.
Expand All @@ -110,7 +107,7 @@

'includeTrashed' => false,

/**
/*
* An array of slug names that can never be used for this model,
* e.g. to prevent collisions with existing routes or controller methods, etc..
* Defaults to null (i.e. no reserved names).
Expand All @@ -136,7 +133,7 @@

'reserved' => null,

/**
/*
* Whether to update the slug value when a model is being
* re-saved (i.e. already exists). Defaults to false, which
* means slugs are not updated.
Expand All @@ -146,13 +143,12 @@
* is probably not a good idea from an SEO point of view.
* Only set this to true if you understand the possible consequences.
*/

'onUpdate' => false,

/**
/*
* If the default slug engine of cocur/slugify is used, this array of
* configuration options will be used when instantiating the engine.
*/
'slugEngineOptions' => [],

];
15 changes: 7 additions & 8 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php namespace Cviebrock\EloquentSluggable;
<?php

namespace Cviebrock\EloquentSluggable;

use Cviebrock\EloquentSluggable\Services\SlugService;
use Illuminate\Foundation\Application as LaravelApplication;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
use Laravel\Lumen\Application as LumenApplication;

/**
* Class ServiceProvider
*
* @package Cviebrock\EloquentSluggable
* Class ServiceProvider.
*/
class ServiceProvider extends BaseServiceProvider
{

/**
* Bootstrap the application services.
*/
Expand All @@ -26,7 +25,7 @@ public function boot(): void
*/
public function register()
{
$this->app->singleton(SluggableObserver::class, function($app) {
$this->app->singleton(SluggableObserver::class, function ($app) {
return new SluggableObserver(new SlugService(), $app['events']);
});
}
Expand All @@ -37,9 +36,9 @@ protected function setUpConfig(): void

if ($this->app instanceof LaravelApplication) {
$this->publishes([$source => config_path('sluggable.php')], 'config');
/** @phpstan-ignore-next-line */
// @phpstan-ignore-next-line
} elseif ($this->app instanceof LumenApplication) {
$this->app->configure('sluggable'); /** @phpstan-ignore class.notFound */
$this->app->configure('sluggable'); // @phpstan-ignore class.notFound
}

$this->mergeConfigFrom($source, 'sluggable');
Expand Down
Loading

0 comments on commit 4db5b07

Please sign in to comment.