Test Setup Failed
Push — master ( ae062b...1a4e45 )
by Php Easy Api
17:51 queued 10s
created

WizardHelper::getAlterBinds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Migratio\GrammarStructure\Mysql\Wizard;
4
5
class WizardHelper
6
{
7
    /**
8
     * @return mixed
9
     */
10
    public function getAutoIncrement()
11
    {
12
        return $this->auto_increment;
13
    }
14
15
    /**
16
     * @return mixed
17
     */
18
    public function getAlterBinds()
19
    {
20
        return $this->alterBinds;
21
    }
22
23
    /**
24
     * @return mixed
25
     */
26
    public function getComment()
27
    {
28
        return $this->comment;
29
    }
30
31
    /**
32
     * @return mixed
33
     */
34
    public function getDefault()
35
    {
36
        return $this->default;
37
    }
38
39
    /**
40
     * @return mixed
41
     */
42
    public function getEngine()
43
    {
44
        return $this->engine;
45
    }
46
47
    /**
48
     * @return mixed
49
     */
50
    public function getError()
51
    {
52
        return $this->error;
53
    }
54
55
    public function getFile()
56
    {
57
        return $this->file;
58
    }
59
60
    /**
61
     * @return mixed
62
     */
63
    public function getIndex()
64
    {
65
        return $this->index;
66
    }
67
68
    /**
69
     * @return mixed
70
     */
71
    public function getNames()
72
    {
73
        return $this->name;
74
    }
75
76
    /**
77
     * @return mixed
78
     */
79
    public function getPrimaryKey()
80
    {
81
        return $this->primaryKey;
82
    }
83
84
    /**
85
     * @return mixed
86
     */
87
    public function getReferences()
88
    {
89
        return $this->references;
90
    }
91
92
    /**
93
     * @return mixed
94
     */
95
    public function getSchemaType()
96
    {
97
        return $this->schemaType;
98
    }
99
100
    /**
101
     * @return mixed
102
     */
103
    public function getTable()
104
    {
105
        return $this->table;
106
    }
107
108
    /**
109
     * @return mixed
110
     */
111
    public function getTypes()
112
    {
113
        return $this->types;
114
    }
115
116
    /**
117
     * @return mixed
118
     */
119
    public function getUnique()
120
    {
121
        return $this->unique;
122
    }
123
124
    /**
125
     * @param $message
126
     */
127
    public function setError($message)
128
    {
129
        $this->error[]=$message;
0 ignored issues
show
Bug Best Practice introduced by
The property error does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
130
    }
131
132
    /**
133
     * @param $engine
134
     */
135
    public function setEngine($engine)
136
    {
137
        $this->engine=$engine;
0 ignored issues
show
Bug Best Practice introduced by
The property engine does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
138
    }
139
140
    /**
141
     * @param $name
142
     */
143
    public function setName($name)
144
    {
145
        $this->name[]=$name;
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
146
    }
147
148
    /**
149
     * @param $file
150
     */
151
    public function setFile($file)
152
    {
153
        $this->file = $file;
0 ignored issues
show
Bug Best Practice introduced by
The property file does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
154
    }
155
156
    /**
157
     * @param $key
158
     * @param $value
159
     */
160
    public function setAlterType($key,$value)
161
    {
162
        $this->alterType[$key]=$value;
0 ignored issues
show
Bug Best Practice introduced by
The property alterType does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
163
    }
164
165
    /**
166
     * @param $table
167
     */
168
    public function setTable($table)
169
    {
170
        $this->table=$table;
0 ignored issues
show
Bug Best Practice introduced by
The property table does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
171
    }
172
173
    /**
174
     * @param $schemaType
175
     */
176
    public function schemaType($schemaType)
177
    {
178
        $this->schemaType=$schemaType;
0 ignored issues
show
Bug Best Practice introduced by
The property schemaType does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
179
    }
180
181
    /**
182
     * @param $type
183
     * @param null $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
184
     * @param null $cond
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $cond is correct as it would always require null to be passed?
Loading history...
185
     */
186
    public function setTypes($type,$value=null,$cond=null)
187
    {
188
        if(!is_array($value) && $value!==null){
0 ignored issues
show
introduced by
The condition is_array($value) is always false.
Loading history...
introduced by
The condition $value !== null is always false.
Loading history...
189
            $this->types[]=''.$type.'('.$value.')';
190
        }
191
        else{
192
193
            if($cond=='enum'){
194
                $this->types[]="".$type."('".implode("','",$value)."')";
0 ignored issues
show
Bug introduced by
$value of type null is incompatible with the type array expected by parameter $pieces of implode(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

194
                $this->types[]="".$type."('".implode("','",/** @scrutinizer ignore-type */ $value)."')";
Loading history...
Bug Best Practice introduced by
The property types does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
195
            }
196
            else{
197
                $this->types[]=''.$type.'';
198
            }
199
200
        }
201
202
    }
203
204
    /**
205
     * @return mixed
206
     */
207
    protected function getLastName(){
208
209
        return end($this->name);
210
    }
211
212
    /**
213
     * @param $collation
214
     */
215
    public function getCollation()
216
    {
217
        return $this->collation;
218
    }
219
220
    /**
221
     * @return mixed
222
     */
223
    public function getNullable()
224
    {
225
        return $this->nullable;
226
    }
227
228
    /**
229
     * @param $name
230
     * @param $data
231
     * @param string $specialist
232
     */
233
    public function updateIndexesForSpecialist($name,$data,$specialist='type')
234
    {
235
        $indexes = $this->getIndex();
236
237
        foreach ($indexes['indexes'] as $key=>$index){
238
239
            if($index['name']==$name){
240
                $this->index['indexes'][$key][$specialist]=$data;
0 ignored issues
show
Bug Best Practice introduced by
The property index does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
241
            }
242
        }
243
    }
244
245
    /**
246
     * @param $constraint
247
     * @param $key
248
     * @param $value
249
     */
250
    public function setReferences($constraint,$key,$value)
251
    {
252
        $this->references[$constraint][$key]=$value;
0 ignored issues
show
Bug Best Practice introduced by
The property references does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
253
    }
254
255
    /**
256
     * @return mixed
257
     */
258
    public function getAlterType()
259
    {
260
        return $this->alterType;
261
    }
262
}
263
264