SpecificationsServiceProvider::boot()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 18
Code Lines 11

Duplication

Lines 14
Ratio 77.78 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 14
loc 18
rs 9.4285
cc 3
eloc 11
nc 4
nop 0
1
<?php
2
3
namespace Pbmedia\Specifications\Laravel;
4
5
use Illuminate\Support\ServiceProvider;
6
use Pbmedia\Specifications\Matcher;
7
8
class SpecificationsServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15 View Code Duplication
        if (!class_exists('CreateSpecificationsAttributesTable')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
            $timestamp = date('Y_m_d_His', time());
17
18
            $this->publishes([
19
                __DIR__ . '/../database/migrations/create_specifications_attributes_table.php.stub' => database_path('migrations/' . $timestamp . '_create_specifications_attributes_table.php'),
20
            ], 'migrations');
21
        }
22
23 View Code Duplication
        if (!class_exists('CreateSpecificationsScoresTable')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
            $timestamp = date('Y_m_d_His', time() + 1);
25
26
            $this->publishes([
27
                __DIR__ . '/../database/migrations/create_specifications_scores_table.php.stub' => database_path('migrations/' . $timestamp . '_create_specifications_scores_table.php'),
28
            ], 'migrations');
29
        }
30
    }
31
32
    /**
33
     * Register the application services.
34
     */
35
    public function register()
36
    {
37
        $this->app->singleton('laravel-specifications-matcher', function ($app) {
38
            return $app->make(Matcher::class);
39
        });
40
    }
41
}
42