Completed
Push — master ( d33c24...eca1e1 )
by Nicolas
03:51
created

LaravelModulesServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 88.24%

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 15
cts 17
cp 0.8824
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 1
A register() 0 6 1
A setupStubPath() 0 10 2
1
<?php
2
3
namespace Nwidart\Modules;
4
5
use Nwidart\Modules\Support\Stub;
6
7
class LaravelModulesServiceProvider extends ModulesServiceProvider
8
{
9
    /**
10
     * Booting the package.
11
     */
12 112
    public function boot()
13
    {
14 112
        $this->registerNamespaces();
15 112
        $this->registerModules();
16 112
    }
17
18
    /**
19
     * Register the service provider.
20
     */
21 112
    public function register()
22
    {
23 112
        $this->registerServices();
24 112
        $this->setupStubPath();
25 112
        $this->registerProviders();
26 112
    }
27
28
    /**
29
     * Setup stub path.
30
     */
31 112
    public function setupStubPath()
32
    {
33 112
        Stub::setBasePath(__DIR__ . '/Commands/stubs');
34
35 112
        $this->app->booted(function ($app) {
36 112
            if ($app['modules']->config('stubs.enabled') === true) {
37
                Stub::setBasePath($app['modules']->config('stubs.path'));
38
            }
39 112
        });
40 112
    }
41
}
42