Test Setup Failed
Push — master ( 43367b...b13334 )
by Php Easy Api
04:33
created

WizardAlterGroup::addUniqueWizardAlterInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
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 1
dl 0
loc 5
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\DropKeyContract;
9
use Migratio\Contract\WizardAlterContract;
10
use Migratio\Contract\WizardAlterGroupContract;
11
12
class WizardAlterGroup extends Wizard implements WizardAlterGroupContract
13
{
14
    /**
15
     * @var array 
16
     */
17
    protected $alterBinds = array();
18
    
19
    /**
20
     * add column
21
     * 
22
     * @return WizardAlterContract
23
     */
24
    public function addColumn()
25
    {
26
        $this->alterBinds[] = __FUNCTION__;
27
        return $this->getWizardAlterInstance(__FUNCTION__);
28
    }
29
30
    /**
31
     * add column
32
     *
33
     * @return IndexContract
34
     */
35
    public function addIndex()
36
    {
37
        $this->alterBinds[] = __FUNCTION__;
38
        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...
39
    }
40
41
    /**
42
     * add column
43
     *
44
     * @return UniqueContract
45
     */
46
    public function addUnique()
47
    {
48
        $this->alterBinds[] = __FUNCTION__;
49
        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...
50
    }
51
52
    /**
53
     * drop column
54
     * 
55
     * @return NameContract
56
     */
57
    public function dropColumn()
58
    {
59
        $this->alterBinds[] = __FUNCTION__;
60
        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...
61
    }
62
63
    /**
64
     * drop column
65
     *
66
     * @return DropKeyContract
67
     */
68
    public function dropKey()
69
    {
70
        $this->alterBinds[] = __FUNCTION__;
71
        return $this->dropKeyWizardAlterInstance(__FUNCTION__);
72
    }
73
74
    /**
75
     * change column
76
     * 
77
     * @return WizardAlterContract
78
     */
79
    public function change()
80
    {
81
        $this->alterBinds[] = __FUNCTION__;
82
        return $this->getWizardAlterInstance(__FUNCTION__);
83
    }
84
85
    /**
86
     * get wizard alter instance
87
     * 
88
     * @param $group
89
     * @return WizardAlter
90
     */
91
    private function getWizardAlterInstance($group)
92
    {
93
        $this->setAlterType('group',$group);
94
95
        return new WizardAlter($this);
96
    }
97
98
    /**
99
     * @param $group
100
     * @return $this
101
     */
102
    private function dropWizardAlterInstance($group)
103
    {
104
        $this->setAlterType('group',$group);
105
106
        return $this;
107
    }
108
109
    /**
110
     * @param $group
111
     * @return DropKeyContract
112
     */
113
    private function dropKeyWizardAlterInstance($group)
114
    {
115
        $this->setAlterType('group',$group);
116
117
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Migratio\GrammarStructur...Wizard\WizardAlterGroup which is incompatible with the documented return type Migratio\Contract\DropKeyContract.
Loading history...
118
    }
119
120
    /**
121
     * @param $group
122
     * @return $this
123
     */
124
    private function addIndexWizardAlterInstance($group)
125
    {
126
        $this->setAlterType('group',$group);
127
128
        return $this;
129
    }
130
131
    /**
132
     * @param $group
133
     * @return $this
134
     */
135
    private function addUniqueWizardAlterInstance($group)
136
    {
137
        $this->setAlterType('group',$group);
138
139
        return $this;
140
    }
141
}
142
143