Migration::migrate()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
nc 1
dl 0
loc 1
ccs 0
cts 0
cp 0
1
<?php
2
namespace Wandu\Service\Eloquent;
3
4
use Illuminate\Database\Capsule\Manager;
5
use Illuminate\Database\Schema\Builder;
6
use Wandu\Migrator\Configuration;
7
use Wandu\Migrator\Contracts\Migration as MigrationContract;
8
9
abstract class Migration implements MigrationContract 
10
{
11
    /** @var \Illuminate\Database\Capsule\Manager */
12
    protected $manager;
13
 
14
    /** @var \Wandu\Database\Configuration */
15
    protected $config;
16
    
17
    public function __construct(Manager $manager, Configuration $config)
18
    {
19
        $this->manager = $manager;
20
        $this->config = $config;
0 ignored issues
show
Documentation Bug introduced by
It seems like $config of type object<Wandu\Migrator\Configuration> is incompatible with the declared type object<Wandu\Database\Configuration> of property $config.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function up()
27
    {
28
        $this->migrate($this->manager->getConnection($this->config->getConnection())->getSchemaBuilder());
0 ignored issues
show
Bug introduced by
The method getConnection() does not seem to exist on object<Wandu\Database\Configuration>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function down()
35
    {
36
        $this->rollback($this->manager->getConnection($this->config->getConnection())->getSchemaBuilder());
0 ignored issues
show
Bug introduced by
The method getConnection() does not seem to exist on object<Wandu\Database\Configuration>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
    }
38
39
    /**
40
     * @param \Illuminate\Database\Schema\Builder $schema
41
     */
42
    abstract public function migrate(Builder $schema);
43
44
    /**
45
     * @param \Illuminate\Database\Schema\Builder $schema
46
     */
47
    abstract public function rollback(Builder $schema);
48
}
49