SlugMakerServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 8
nc 2
nop 0
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Fomvasss\SlugMaker;
4
5
use Fomvasss\SlugMaker\Models\Slug;
6
use Illuminate\Support\ServiceProvider;
7
8
class SlugMakerServiceProvider extends ServiceProvider
9
{
10
    public function boot()
11
    {
12
        $this->publishes([
13
            __DIR__.'/../config/slugmaker.php' => $this->app->configPath().'/slugmaker.php',
0 ignored issues
show
Bug introduced by
The method configPath() does not exist on Illuminate\Contracts\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

13
            __DIR__.'/../config/slugmaker.php' => $this->app->/** @scrutinizer ignore-call */ configPath().'/slugmaker.php',

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
14
        ], 'slugmaker-config');
15
16
        if (! class_exists('CreateSlugsTable')) {
17
            $timestamp = date('Y_m_d_His', time());
18
19
            $this->publishes([
20
                __DIR__.'/../database/migrations/create_slugs_table.php.stub' => $this->app->databasePath()."/migrations/{$timestamp}_create_slugs_table.php",
0 ignored issues
show
Bug introduced by
The method databasePath() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean basePath()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
                __DIR__.'/../database/migrations/create_slugs_table.php.stub' => $this->app->/** @scrutinizer ignore-call */ databasePath()."/migrations/{$timestamp}_create_slugs_table.php",

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
            ], 'slugmaker-migrations');
22
        }
23
    }
24
25
    public function register()
26
    {
27
        $this->mergeConfigFrom(__DIR__.'/../config/slugmaker.php', 'slugmaker');
28
29
        $this->app->bind(SlugHelper::class, function () {
30
            return new SlugHelper(new Slug());
0 ignored issues
show
Unused Code introduced by
The call to Fomvasss\SlugMaker\SlugHelper::__construct() has too many arguments starting with new Fomvasss\SlugMaker\Models\Slug(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
            return /** @scrutinizer ignore-call */ new SlugHelper(new Slug());

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
31
        });
32
    }
33
}
34