BlockchainServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 14
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Appino\Blockchain;
4
5
use Appino\Blockchain\Classes\Blockchain;
6
use Appino\Blockchain\Classes\Receive;
7
use Illuminate\Contracts\Container\Container;
8
use Illuminate\Support\ServiceProvider;
9
10
class BlockchainServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     */
15
    public function boot()
16
    {
17
        /*
18
         * Optional methods to load your package assets
19
         */
20
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'blockchain');
21
        // $this->loadViewsFrom(__DIR__.'/../resources/views', 'blockchain');
22
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
23
        // $this->loadRoutesFrom(__DIR__.'/routes.php');
24
25
        if ($this->app->runningInConsole()) {
26
            $this->publishes([
27
                __DIR__.'/../config/config.php' => config_path('blockchain.php'),
0 ignored issues
show
Bug introduced by
The function config_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

27
                __DIR__.'/../config/config.php' => /** @scrutinizer ignore-call */ config_path('blockchain.php'),
Loading history...
28
            ], 'config');
29
30
31
            // Publishing the views.
32
            /*$this->publishes([
33
                __DIR__.'/../resources/views' => resource_path('views/vendor/blockchain'),
34
            ], 'views');*/
35
36
            // Publishing assets.
37
            /*$this->publishes([
38
                __DIR__.'/../resources/assets' => public_path('vendor/blockchain'),
39
            ], 'assets');*/
40
41
            // Publishing the translation files.
42
            /*$this->publishes([
43
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/blockchain'),
44
            ], 'lang');*/
45
46
            // Registering package commands.
47
            // $this->commands([]);
48
        }
49
    }
50
51
    /**
52
     * Register the application services.
53
     */
54
    public function register()
55
    {
56
        // Automatically apply the package configuration
57
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'blockchain');
58
59
        // Register the main class to use with the facade
60
        $this->app->singleton('blockchain', function () {
61
            $config = app('config')->get('blockchain');
0 ignored issues
show
Bug introduced by
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

61
            $config = /** @scrutinizer ignore-call */ app('config')->get('blockchain');
Loading history...
62
            return (new Blockchain($config));
63
        });
64
    }
65
}
66