Test Setup Failed
Push — master ( d6fde7...1e848b )
by Php Easy Api
04:20
created

WizardHelper::getCollation()   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 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 getComment()
19
    {
20
        return $this->comment;
21
    }
22
23
    /**
24
     * @return mixed
25
     */
26
    public function getDefault()
27
    {
28
        return $this->default;
29
    }
30
31
    /**
32
     * @return mixed
33
     */
34
    public function getEngine()
35
    {
36
        return $this->engine;
37
    }
38
39
    /**
40
     * @return mixed
41
     */
42
    public function getError()
43
    {
44
        return $this->error;
45
    }
46
47
    public function getFile()
48
    {
49
        return $this->file;
50
    }
51
52
    /**
53
     * @return mixed
54
     */
55
    public function getIndex()
56
    {
57
        return $this->index;
58
    }
59
60
    /**
61
     * @return mixed
62
     */
63
    public function getNames()
64
    {
65
        return $this->name;
66
    }
67
68
    /**
69
     * @return mixed
70
     */
71
    public function getPrimaryKey()
72
    {
73
        return $this->primaryKey;
74
    }
75
76
    /**
77
     * @return mixed
78
     */
79
    public function getReferences()
80
    {
81
        return $this->references;
82
    }
83
84
    /**
85
     * @return mixed
86
     */
87
    public function getSchemaType()
88
    {
89
        return $this->schemaType;
90
    }
91
92
    /**
93
     * @return mixed
94
     */
95
    public function getTable()
96
    {
97
        return $this->table;
98
    }
99
100
    /**
101
     * @return mixed
102
     */
103
    public function getTypes()
104
    {
105
        return $this->types;
106
    }
107
108
    /**
109
     * @return mixed
110
     */
111
    public function getUnique()
112
    {
113
        return $this->unique;
114
    }
115
116
    /**
117
     * @param $message
118
     */
119
    public function setError($message)
120
    {
121
        $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...
122
    }
123
124
    /**
125
     * @param $engine
126
     */
127
    public function setEngine($engine)
128
    {
129
        $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...
130
    }
131
132
    /**
133
     * @param $name
134
     */
135
    public function setName($name)
136
    {
137
        $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...
138
    }
139
140
    /**
141
     * @param $file
142
     */
143
    public function setFile($file)
144
    {
145
        $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...
146
    }
147
148
    /**
149
     * @param $key
150
     * @param $value
151
     */
152
    public function setAlterType($key,$value)
153
    {
154
        $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...
155
    }
156
157
    /**
158
     * @param $table
159
     */
160
    public function setTable($table)
161
    {
162
        $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...
163
    }
164
165
    /**
166
     * @param $schemaType
167
     */
168
    public function schemaType($schemaType)
169
    {
170
        $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...
171
    }
172
173
    /**
174
     * @param $type
175
     * @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...
176
     * @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...
177
     */
178
    public function setTypes($type,$value=null,$cond=null)
179
    {
180
        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...
181
            $this->types[]=''.$type.'('.$value.')';
182
        }
183
        else{
184
185
            if($cond=='enum'){
186
                $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

186
                $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...
187
            }
188
            else{
189
                $this->types[]=''.$type.'';
190
            }
191
192
        }
193
194
    }
195
196
    /**
197
     * @return mixed
198
     */
199
    protected function getLastName(){
200
201
        return end($this->name);
202
    }
203
204
    /**
205
     * @param $collation
206
     */
207
    public function getCollation()
208
    {
209
        return $this->collation;
210
    }
211
212
    /**
213
     * @return mixed
214
     */
215
    public function getNullable()
216
    {
217
        return $this->nullable;
218
    }
219
220
    /**
221
     * @param $name
222
     * @param $data
223
     * @param string $specialist
224
     */
225
    public function updateIndexesForSpecialist($name,$data,$specialist='type')
226
    {
227
        $indexes = $this->getIndex();
228
229
        foreach ($indexes['indexes'] as $key=>$index){
230
231
            if($index['name']==$name){
232
                $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...
233
            }
234
        }
235
    }
236
237
    /**
238
     * @param $constraint
239
     * @param $key
240
     * @param $value
241
     */
242
    public function setReferences($constraint,$key,$value)
243
    {
244
        $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...
245
    }
246
247
    /**
248
     * @return mixed
249
     */
250
    public function getAlterType()
251
    {
252
        return $this->alterType;
253
    }
254
}
255
256