Completed
Push — master ( cc7b64...53b465 )
by Nicolas
11s
created

Module   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 54.55%

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 30
ccs 6
cts 11
cp 0.5455
rs 10
wmc 4
lcom 1
cbo 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCachedServicesPath() 0 4 1
A registerProviders() 0 5 1
A registerAliases() 0 7 2
1
<?php
2
3
namespace Nwidart\Modules\Laravel;
4
5
use Illuminate\Filesystem\Filesystem;
6
use Illuminate\Foundation\AliasLoader;
7
use Illuminate\Foundation\ProviderRepository;
8
use Illuminate\Support\Str;
9
use Nwidart\Modules\Module as BaseModule;
10
11
class Module extends BaseModule
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 3
    public function getCachedServicesPath()
17
    {
18 3
        return Str::replaceLast('services.php', $this->getSnakeName() . '_module.php', $this->app->getCachedServicesPath());
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 2
    public function registerProviders()
25
    {
26 2
        (new ProviderRepository($this->app, new Filesystem(), $this->getCachedServicesPath()))
27 2
            ->load($this->get('providers', []));
28 2
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function registerAliases()
34
    {
35
        $loader = AliasLoader::getInstance();
36
        foreach ($this->get('aliases', []) as $aliasName => $aliasClass) {
37
            $loader->alias($aliasName, $aliasClass);
38
        }
39
    }
40
}
41