Completed
Pull Request — master (#333)
by
unknown
59:20
created

LaravelModulesServiceProvider::setupStubPath()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0116

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 7
cp 0.8571
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 1
nop 0
crap 2.0116
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 136
    public function boot()
13
    {
14 136
        $this->registerNamespaces();
15 136
        $this->registerModules();
16 136
    }
17
18
    /**
19
     * Register the service provider.
20
     */
21 136
    public function register()
22
    {
23 136
        $this->registerServices();
24 136
        $this->setupStubPath();
25 136
        $this->registerProviders();
26 136
    }
27
28
    /**
29
     * Setup stub path.
30
     */
31 136
    public function setupStubPath()
32
    {
33 136
        Stub::setBasePath(__DIR__ . '/Commands/stubs');
34
35 136
        $this->app->booted(function ($app) {
36 136
            if ($app['modules']->config('stubs.enabled') === true) {
37
                Stub::setBasePath($app['modules']->config('stubs.path'));
38
            }
39 136
        });
40 136
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 View Code Duplication
    protected function registerServices()
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
    {
47 136
        $this->app->singleton('modules', function ($app) {
48 136
            $path = $app['config']->get('modules.paths.modules');
49
50 136
            return new \Nwidart\Modules\Laravel\Repository($app, $path);
51 136
        });
52
    }
53
}
54