Completed
Push — master ( de7438...b51e5e )
by Nicolas
12:59
created

LaravelModulesServiceProvider::setupStubPath()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
ccs 5
cts 6
cp 0.8333
cc 2
eloc 5
nc 1
nop 0
crap 2.0185
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 114
    public function boot()
13
    {
14 114
        $this->registerNamespaces();
15 114
        $this->registerModules();
16 114
    }
17
18
    /**
19
     * Register the service provider.
20
     */
21 114
    public function register()
22
    {
23 114
        $this->registerServices();
24 114
        $this->setupStubPath();
25 114
        $this->registerProviders();
26 114
    }
27
28
    /**
29
     * Setup stub path.
30
     */
31 114
    public function setupStubPath()
32
    {
33 114
        Stub::setBasePath(__DIR__ . '/Commands/stubs');
34
35 114
        $this->app->booted(function ($app) {
36 114
            if ($app['modules']->config('stubs.enabled') === true) {
37
                Stub::setBasePath($app['modules']->config('stubs.path'));
38
            }
39 114
        });
40
    }
41
}
42