Test Failed
Push — master ( fe7900...79d767 )
by Attila
11:12
created

BaseModuleServiceProvider::getNamespaceRoot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Contains the BaseModuleServiceProvider class.
7
 *
8
 * @copyright   Copyright (c) 2016 Attila Fulop
9
 * @author      Attila Fulop
10
 * @license     MIT
11
 * @since       2016-08-14
12
 *
13
 */
14
15
namespace Konekt\Concord;
16
17
use Illuminate\Support\ServiceProvider;
18
use Konekt\Concord\Concerns\AutoGeneratesModuleId;
19
use Konekt\Concord\Concerns\HasDefaultConvention;
20
use Konekt\Concord\Concerns\HasModuleConfig;
21
use Konekt\Concord\Concerns\ReadsManifestFile;
22
use Konekt\Concord\Concerns\RegistersEnums;
23
use Konekt\Concord\Contracts\Concord as ConcordContract;
24
use Konekt\Concord\Contracts\Module;
25
use Konekt\Concord\Module\Kind;
26
use ReflectionClass;
27
28
class BaseModuleServiceProvider extends ServiceProvider implements Module
29
{
30
    use HasModuleConfig;
31
    use AutoGeneratesModuleId;
32
    use HasDefaultConvention;
33
    use RegistersEnums;
34
    use ReadsManifestFile;
35
36
    private string $basePath;
37
38
    public function __construct($app)
39
    {
40
        parent::__construct($app);
41
42
        $this->concord = $app->make(ConcordContract::class);
43
        $this->basePath = dirname(dirname((new ReflectionClass(static::class))->getFileName()));
44
    }
45
46
    public function boot()
47
    {
48
        if ($this->areMigrationsEnabled()) {
49
            //$this->registerMigrations();
50
        }
51
52
        if ($this->areModelsEnabled()) {
53
            //$this->registerModels();
54
            $this->registerEnums();
55
            //$this->registerRequestTypes();
56
        }
57
    }
58
59
    public function getName(): string
60
    {
61
        return $this->manifest(static::getConvention())->getName();
62
    }
63
64
    public function getVersion(): ?string
65
    {
66
        return $this->manifest(static::getConvention())->getVersion();
67
    }
68
69
    public function getBasePath(): string
70
    {
71
        return $this->basePath;
72
    }
73
74
    public function getNamespaceRoot(): string
75
    {
76
        return '';
77
    }
78
79
    public function getKind(): Kind
80
    {
81
        return Kind::MODULE();
0 ignored issues
show
Bug introduced by
The method MODULE() does not exist on Konekt\Concord\Module\Kind. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

81
        return Kind::/** @scrutinizer ignore-call */ MODULE();
Loading history...
82
    }
83
84
    public function shortName()
85
    {
86
        return '';
87
    }
88
}
89