Passed
Branch master (694ff0)
by Jeremy
02:12
created

LaravelUsersServiceProvider::publishFiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace jeremykenedy\laravelusers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class LaravelUsersServiceProvider extends ServiceProvider
8
{
9
    private $_packageTag = 'laravelusers';
10
11
    /**
12
     * Indicates if loading of the provider is deferred.
13
     *
14
     * @var bool
15
     */
16
    protected $defer = false;
17
18
    /**
19
     * Bootstrap the application services.
20
     *
21
     * @return void
22
     */
23
    public function boot()
24
    {
25
        $this->loadTranslationsFrom(__DIR__.'/resources/lang/', $this->_packageTag);
26
    }
27
28
    /**
29
     * Register the application services.
30
     *
31
     * @return void
32
     */
33
    public function register()
34
    {
35
        $this->loadRoutesFrom(__DIR__.'/routes/web.php');
36
        $this->loadViewsFrom(__DIR__.'/resources/views/', $this->_packageTag);
37
        $this->mergeConfigFrom(__DIR__.'/config/'.$this->_packageTag.'.php', $this->_packageTag);
38
        $this->publishFiles();
39
        $this->app->make('jeremykenedy\laravelusers\App\Http\Controllers\UsersManagementController');
40
        $this->app->singleton(UsersManagementController::class, function () {
0 ignored issues
show
Bug introduced by
The type jeremykenedy\laraveluser...ersManagementController 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...
41
            return new App\Http\Controllers\UsersManagementController();
42
        });
43
        $this->app->alias(UsersManagementController::class, 'laravelusers');
44
    }
45
46
    /**
47
     * Publish files for the package.
48
     *
49
     * @return void
50
     */
51
    private function publishFiles()
52
    {
53
        $publishTag = $this->_packageTag;
54
55
        $this->publishes([
56
            __DIR__.'/config/'.$this->_packageTag.'.php' => base_path('config/'.$this->_packageTag.'.php'),
57
        ], $publishTag);
58
59
        $this->publishes([
60
            __DIR__.'/resources/views' => resource_path('views/vendor/'.$this->_packageTag),
61
        ], $publishTag);
62
63
        $this->publishes([
64
            __DIR__.'/resources/lang' => resource_path('lang/vendor/'.$this->_packageTag),
65
        ], $publishTag);
66
    }
67
}
68