Passed
Push — master ( 28f242...472b4c )
by Gabriel
04:44
created

MigrationsServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 32
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 3 1
A provides() 0 3 1
A registerCommands() 0 5 1
A registerMigrator() 0 5 1
1
<?php
2
3
namespace ByTIC\Migrations;
4
5
use ByTIC\Migrations\Console\CreateCommand;
6
use ByTIC\Migrations\Console\MigrateCommand;
7
use Nip\Container\ServiceProviders\Providers\AbstractSignatureServiceProvider;
8
9
/**
10
 * Class MigrationsServiceProvider
11
 * @package ByTIC\Scheduler
12
 */
13
class MigrationsServiceProvider extends AbstractSignatureServiceProvider
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public function register()
19
    {
20
        $this->registerMigrator();
21
    }
22
23
    protected function registerMigrator()
24
    {
25
        $this->getContainer()->share('migrations.migrator', function () {
26
            $migrator = $this->getContainer()->get(Migrator::class);
27
            return $migrator;
28
        });
29
    }
30
31
    protected function registerCommands()
32
    {
33
        $this->commands(
34
            MigrateCommand::class,
35
            CreateCommand::class
36
        );
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42
    public function provides()
43
    {
44
        return ['migrations.migrator'];
45
    }
46
}
47