Completed
Push — master ( 419c88...940d42 )
by Nicolas
03:31
created

ModulesServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Nwidart\Modules;
4
5
use Illuminate\Support\ServiceProvider;
6
use Nwidart\Modules\Providers\BootstrapServiceProvider;
7
use Nwidart\Modules\Providers\ConsoleServiceProvider;
8
use Nwidart\Modules\Providers\ContractsServiceProvider;
9
10
abstract class ModulesServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Booting the package.
14
     */
15
    public function boot()
16
    {
17
    }
18
19
    /**
20
     * Register all modules.
21
     */
22
    public function register()
23
    {
24
    }
25
26
    /**
27
     * Register all modules.
28
     */
29 190
    protected function registerModules()
30
    {
31 190
        $this->app->register(BootstrapServiceProvider::class);
32 190
    }
33
34
    /**
35
     * Register package's namespaces.
36
     */
37 190
    protected function registerNamespaces()
38
    {
39 190
        $configPath = __DIR__ . '/../config/config.php';
40
41 190
        $this->mergeConfigFrom($configPath, 'modules');
42 190
        $this->publishes([
43 190
            $configPath => config_path('modules.php'),
44 190
        ], 'config');
45 190
    }
46
47
    /**
48
     * Register the service provider.
49
     */
50
    abstract protected function registerServices();
51
52
    /**
53
     * Get the services provided by the provider.
54
     *
55
     * @return array
56
     */
57
    public function provides()
58
    {
59
        return [Contracts\RepositoryInterface::class, 'modules'];
60
    }
61
62
    /**
63
     * Register providers.
64
     */
65 190
    protected function registerProviders()
66
    {
67 190
        $this->app->register(ConsoleServiceProvider::class);
68 190
        $this->app->register(ContractsServiceProvider::class);
69 190
    }
70
}
71