UnsplashServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 18 2
A register() 0 15 1
1
<?php
2
3
namespace MarkSitko\LaravelUnsplash;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class UnsplashServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        /*
15
         * Optional methods to load your package assets
16
         */
17
        if ($this->app->runningInConsole()) {
18
            $this->publishes([
19
                __DIR__.'/../config/unsplash.php' => config_path('unsplash.php'),
20
            ], 'config');
21
22
            $this->publishes([
23
                __DIR__.'/../database/migrations/create_unsplashables_table.php.stub' => database_path('migrations').'/'.date('Y_m_d_His').'_create_unsplashables_table.php',
24
            ], 'migrations');
25
            $this->publishes([
26
                __DIR__.'/../database/migrations/create_unsplash_assets_table.php.stub' => database_path('migrations').'/'.date('Y_m_d_His').'_create_unsplash_assets_table.php',
27
            ], 'migrations');
28
        }
29
    }
30
31
    /**
32
     * Register the application services.
33
     */
34
    public function register()
35
    {
36
        // Automatically apply the package configuration
37
        $this->mergeConfigFrom(__DIR__.'/../config/unsplash.php', 'unsplash');
38
39
        // Register the main class to use with the facade
40
        $this->app->singleton('unsplash', function () {
41
            return new Unsplash();
42
        });
43
44
        // Bind main class to service container
45
        $this->app->bind(Unsplash::class, function () {
46
            return new Unsplash();
47
        });
48
    }
49
}
50