PromocodesServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 14 2
A register() 0 10 1
1
<?php
2
3
namespace Gabievi\Promocodes;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class PromocodesServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     *
12
     * @return void
13
     */
14
    public function boot()
15
    {
16
        $this->publishes([
17
            __DIR__ . '/../config/promocodes.php' => config_path('promocodes.php'),
18
        ]);
19
20
        if (!class_exists('CreatePromocodesTable')) {
21
            $timestamp = date('Y_m_d_His', time());
22
23
            $this->publishes([
24
                __DIR__ . '/../migrations/create_promocodes_table.php.stub' => database_path("/migrations/{$timestamp}_create_promocodes_table.php"),
25
            ], 'migrations');
26
        }
27
    }
28
29
    /**
30
     * Register the application services.
31
     *
32
     * @return void
33
     */
34
    public function register()
35
    {
36
        $this->mergeConfigFrom(
37
            __DIR__ . '/../config/promocodes.php', 'promocodes'
38
        );
39
40
        $this->app->singleton('promocodes', function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
41
            return new Promocodes();
42
        });
43
    }
44
}
45