Test Setup Failed
Push — master ( 058fd4...43367b )
by Php Easy Api
04:57
created

WizardAlterGroup::change()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Migratio\GrammarStructure\Mysql\Wizard;
4
5
use Migratio\Contract\NameContract;
6
use Migratio\Contract\IndexContract;
7
use Migratio\Contract\UniqueContract;
8
use Migratio\Contract\WizardAlterContract;
9
use Migratio\Contract\WizardAlterGroupContract;
10
11
class WizardAlterGroup extends Wizard implements WizardAlterGroupContract
12
{
13
    /**
14
     * @var array 
15
     */
16
    protected $alterBinds = array();
17
    
18
    /**
19
     * add column
20
     * 
21
     * @return WizardAlterContract
22
     */
23
    public function addColumn()
24
    {
25
        $this->alterBinds[] = __FUNCTION__;
26
        return $this->getWizardAlterInstance(__FUNCTION__);
27
    }
28
29
    /**
30
     * add column
31
     *
32
     * @return IndexContract
33
     */
34
    public function addIndex()
35
    {
36
        $this->alterBinds[] = __FUNCTION__;
37
        return $this->addIndexWizardAlterInstance(__FUNCTION__);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->addIndexWi...rInstance(__FUNCTION__) returns the type Migratio\GrammarStructur...Wizard\WizardAlterGroup which is incompatible with the documented return type Migratio\Contract\IndexContract.
Loading history...
38
    }
39
40
    /**
41
     * add column
42
     *
43
     * @return UniqueContract
44
     */
45
    public function addUnique()
46
    {
47
        $this->alterBinds[] = __FUNCTION__;
48
        return $this->addUniqueWizardAlterInstance(__FUNCTION__);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->addUniqueW...rInstance(__FUNCTION__) returns the type Migratio\GrammarStructur...Wizard\WizardAlterGroup which is incompatible with the documented return type Migratio\Contract\UniqueContract.
Loading history...
49
    }
50
51
    /**
52
     * drop column
53
     * 
54
     * @return NameContract
55
     */
56
    public function dropColumn()
57
    {
58
        $this->alterBinds[] = __FUNCTION__;
59
        return $this->dropWizardAlterInstance(__FUNCTION__);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->dropWizard...rInstance(__FUNCTION__) returns the type Migratio\GrammarStructur...Wizard\WizardAlterGroup which is incompatible with the documented return type Migratio\Contract\NameContract.
Loading history...
60
    }
61
62
    /**
63
     * change column
64
     * 
65
     * @return WizardAlterContract
66
     */
67
    public function change()
68
    {
69
        $this->alterBinds[] = __FUNCTION__;
70
        return $this->getWizardAlterInstance(__FUNCTION__);
71
    }
72
73
    /**
74
     * get wizard alter instance
75
     * 
76
     * @param $group
77
     * @return WizardAlter
78
     */
79
    private function getWizardAlterInstance($group)
80
    {
81
        $this->setAlterType('group',$group);
82
83
        return new WizardAlter($this);
84
    }
85
86
    /**
87
     * @param $group
88
     * @return $this
89
     */
90
    private function dropWizardAlterInstance($group)
91
    {
92
        $this->setAlterType('group',$group);
93
94
        return $this;
95
    }
96
97
    /**
98
     * @param $group
99
     * @return $this
100
     */
101
    private function addIndexWizardAlterInstance($group)
102
    {
103
        $this->setAlterType('group',$group);
104
105
        return $this;
106
    }
107
108
    /**
109
     * @param $group
110
     * @return $this
111
     */
112
    private function addUniqueWizardAlterInstance($group)
113
    {
114
        $this->setAlterType('group',$group);
115
116
        return $this;
117
    }
118
}
119
120