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

WizardHelper::setEngine()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
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 getKeys()
27
    {
28
        return $this->key;
29
    }
30
31
    /**
32
     * @return mixed
33
     */
34
    public function getComment()
35
    {
36
        return $this->comment;
37
    }
38
39
    /**
40
     * @return mixed
41
     */
42
    public function getDefault()
43
    {
44
        return $this->default;
45
    }
46
47
    /**
48
     * @return mixed
49
     */
50
    public function getEngine()
51
    {
52
        return $this->engine;
53
    }
54
55
    /**
56
     * @return mixed
57
     */
58
    public function getError()
59
    {
60
        return $this->error;
61
    }
62
63
    public function getFile()
64
    {
65
        return $this->file;
66
    }
67
68
    /**
69
     * @return mixed
70
     */
71
    public function getIndex()
72
    {
73
        return $this->index;
74
    }
75
76
    /**
77
     * @return mixed
78
     */
79
    public function getNames()
80
    {
81
        return $this->name;
82
    }
83
84
    /**
85
     * @return mixed
86
     */
87
    public function getPrimaryKey()
88
    {
89
        return $this->primaryKey;
90
    }
91
92
    /**
93
     * @return mixed
94
     */
95
    public function getReferences()
96
    {
97
        return $this->references;
98
    }
99
100
    /**
101
     * @return mixed
102
     */
103
    public function getSchemaType()
104
    {
105
        return $this->schemaType;
106
    }
107
108
    /**
109
     * @return mixed
110
     */
111
    public function getTable()
112
    {
113
        return $this->table;
114
    }
115
116
    /**
117
     * @return mixed
118
     */
119
    public function getTypes()
120
    {
121
        return $this->types;
122
    }
123
124
    /**
125
     * @return mixed
126
     */
127
    public function getUnique()
128
    {
129
        return $this->unique;
130
    }
131
132
    /**
133
     * @param $message
134
     */
135
    public function setError($message)
136
    {
137
        $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...
138
    }
139
140
    /**
141
     * @param $engine
142
     */
143
    public function setEngine($engine)
144
    {
145
        $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...
146
    }
147
148
    /**
149
     * @param $name
150
     */
151
    public function setName($name)
152
    {
153
        $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...
154
    }
155
156
    /**
157
     * @param $file
158
     */
159
    public function setFile($file)
160
    {
161
        $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...
162
    }
163
164
    /**
165
     * @param $key
166
     * @param $value
167
     */
168
    public function setAlterType($key,$value)
169
    {
170
        $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...
171
    }
172
173
    /**
174
     * @param $table
175
     */
176
    public function setTable($table)
177
    {
178
        $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...
179
    }
180
181
    /**
182
     * @param $schemaType
183
     */
184
    public function schemaType($schemaType)
185
    {
186
        $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...
187
    }
188
189
    /**
190
     * @param $type
191
     * @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...
192
     * @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...
193
     */
194
    public function setTypes($type,$value=null,$cond=null)
195
    {
196
        if(!is_array($value) && $value!==null){
0 ignored issues
show
introduced by
The condition $value !== null is always false.
Loading history...
introduced by
The condition is_array($value) is always false.
Loading history...
197
            $this->types[]=''.$type.'('.$value.')';
198
        }
199
        else{
200
201
            if($cond=='enum'){
202
                $this->types[]="".$type."('".implode("','",$value)."')";
0 ignored issues
show
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...
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

202
                $this->types[]="".$type."('".implode("','",/** @scrutinizer ignore-type */ $value)."')";
Loading history...
203
            }
204
            else{
205
                $this->types[]=''.$type.'';
206
            }
207
208
        }
209
210
    }
211
212
    /**
213
     * @return mixed
214
     */
215
    protected function getLastName(){
216
217
        return end($this->name);
218
    }
219
220
    /**
221
     * @param $collation
222
     */
223
    public function getCollation()
224
    {
225
        return $this->collation;
226
    }
227
228
    /**
229
     * @return mixed
230
     */
231
    public function getNullable()
232
    {
233
        return $this->nullable;
234
    }
235
236
    /**
237
     * @param $name
238
     * @param $data
239
     * @param string $specialist
240
     */
241
    public function updateIndexesForSpecialist($name,$data,$specialist='type')
242
    {
243
        $indexes = $this->getIndex();
244
245
        foreach ($indexes['indexes'] as $key=>$index){
246
247
            if($index['name']==$name){
248
                $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...
249
            }
250
        }
251
    }
252
253
    /**
254
     * @param $constraint
255
     * @param $key
256
     * @param $value
257
     */
258
    public function setReferences($constraint,$key,$value)
259
    {
260
        $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...
261
    }
262
263
    /**
264
     * @return mixed
265
     */
266
    public function getAlterType()
267
    {
268
        return $this->alterType;
269
    }
270
}
271
272