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

Module::getCachedServicesPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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