SmsirlaravelServiceProvider::boot()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 26
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 15
nc 4
nop 0
dl 0
loc 26
rs 9.7666
c 1
b 0
f 0
1
<?php
2
3
namespace Cryptommer\Smsirlaravel;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class SmsirlaravelServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
15
        if (config('smsirlaravel.panel-routes', true)) {
0 ignored issues
show
Bug introduced by
The function config 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

15
        if (/** @scrutinizer ignore-call */ config('smsirlaravel.panel-routes', true)) {
Loading history...
16
            $this->loadRoutesFrom(__DIR__ . '/routes.php');
17
        }
18
        $this->loadViewsFrom(__DIR__.'/views', 'smsirlaravel');
19
20
        if ($this->app->runningInConsole()) {
21
            $this->publishes([
22
                __DIR__.'/../config/config.php' => config_path('smsirlaravel.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

22
                __DIR__.'/../config/config.php' => /** @scrutinizer ignore-call */ config_path('smsirlaravel.php'),
Loading history...
23
            ], 'config');
24
25
            // for publish the views into main app
26
            $this->publishes([
27
                __DIR__.'/views' => resource_path('views/vendor/smsirlaravel'),
0 ignored issues
show
Bug introduced by
The function resource_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__.'/views' => /** @scrutinizer ignore-call */ resource_path('views/vendor/smsirlaravel'),
Loading history...
28
            ]);
29
30
            $this->publishes([
31
                __DIR__.'/migrations/' => database_path('migrations')
0 ignored issues
show
Bug introduced by
The function database_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

31
                __DIR__.'/migrations/' => /** @scrutinizer ignore-call */ database_path('migrations')
Loading history...
32
            ], 'migrations');
33
34
            // for publish the assets files into main app
35
            $this->publishes([
36
                __DIR__.'/assets' => public_path('vendor/smsirlaravel'),
0 ignored issues
show
Bug introduced by
The function public_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

36
                __DIR__.'/assets' => /** @scrutinizer ignore-call */ public_path('vendor/smsirlaravel'),
Loading history...
37
            ], 'public');
38
        }
39
    }
40
41
    /**
42
     * Register the application services.
43
     */
44
    public function register()
45
    {
46
        // Automatically apply the package configuration
47
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'smsirlaravel');
48
49
        // Register the main class to use with the facade
50
        $this->app->singleton('smsirlaravel', function () {
51
            return new Smsirlaravel;
52
        });
53
    }
54
}
55