LaravelPackagistServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 19
c 1
b 0
f 0
dl 0
loc 72
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 5 1
A provides() 0 3 1
A packageRegistration() 0 8 1
A publishFiles() 0 9 1
A boot() 0 3 1
1
<?php
2
3
namespace jeremykenedy\LaravelPackagist;
4
5
use Illuminate\Foundation\AliasLoader;
0 ignored issues
show
Bug introduced by
The type Illuminate\Foundation\AliasLoader was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Support\ServiceProvider;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\ServiceProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class LaravelPackagistServiceProvider extends ServiceProvider
9
{
10
    private $_packageTag = 'laravelpackagist';
11
12
    /**
13
     * Indicates if loading of the provider is deferred.
14
     *
15
     * @var bool
16
     */
17
    protected $defer = false;
18
19
    /**
20
     * Bootstrap the application services.
21
     *
22
     * @return void
23
     */
24
    public function boot()
25
    {
26
        $this->loadTranslationsFrom(__DIR__.'/resources/lang/', $this->_packageTag);
27
    }
28
29
    /**
30
     * Register the application services.
31
     *
32
     * @return void
33
     */
34
    public function register()
35
    {
36
        $this->packageRegistration();
37
        $this->mergeConfigFrom(__DIR__.'/config/'.$this->_packageTag.'.php', $this->_packageTag);
38
        $this->publishFiles();
39
    }
40
41
    /**
42
     * Package Registration.
43
     *
44
     * @return void
45
     */
46
    private function packageRegistration()
47
    {
48
        $this->app->make('jeremykenedy\LaravelPackagist\App\Services\PackagistApiServices');
49
        AliasLoader::getInstance()->alias('PackagistApiServices', \jeremykenedy\LaravelPackagist\App\Services\PackagistApiServices::class);
50
        $this->app->singleton(jeremykenedy\LaravelPackagist\App\Services\PackagistApiServices::class, function () {
0 ignored issues
show
Bug introduced by
The type jeremykenedy\LaravelPack...es\PackagistApiServices was not found. Did you mean jeremykenedy\LaravelPack...es\PackagistApiServices? If so, make sure to prefix the type with \.
Loading history...
51
            return new jeremykenedy\LaravelPackagist\App\Services\PackagistApiServices();
52
        });
53
        $this->app->alias(jeremykenedy\LaravelPackagist\App\Services\PackagistApiServices::class, $this->_packageTag);
54
    }
55
56
    /**
57
     * Get the services provided by the provider.
58
     *
59
     * @return array
60
     */
61
    public function provides()
62
    {
63
        return [$this->_packageTag];
64
    }
65
66
    /**
67
     * Publish files for Laravel Blocker.
68
     *
69
     * @return void
70
     */
71
    private function publishFiles()
72
    {
73
        $this->publishes([
74
            __DIR__.'/config/'.$this->_packageTag.'.php' => base_path('config/'.$this->_packageTag.'.php'),
0 ignored issues
show
Bug introduced by
The function base_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

74
            __DIR__.'/config/'.$this->_packageTag.'.php' => /** @scrutinizer ignore-call */ base_path('config/'.$this->_packageTag.'.php'),
Loading history...
75
        ], $this->_packageTag.'-config');
76
77
        $this->publishes([
78
            __DIR__.'/resources/lang' => base_path('resources/lang/vendor/'.$this->_packageTag),
79
        ], $this->_packageTag.'-lang');
80
    }
81
}
82