Completed
Pull Request — master (#1151)
by
unknown
13:35 queued 08:07
created

Module   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 53.85%

Importance

Changes 0
Metric Value
dl 0
loc 45
c 0
b 0
f 0
rs 10
ccs 7
cts 13
cp 0.5385
wmc 7
lcom 1
cbo 5

6 Methods

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