@@ -161,8 +161,7 @@ |
||
161 | 161 | if($table===false) |
162 | 162 | { |
163 | 163 | $this->collation[$this->getLastName()]=$value; |
164 | - } |
|
165 | - else{ |
|
164 | + } else{ |
|
166 | 165 | $this->collation['table']=$value; |
167 | 166 | } |
168 | 167 |
@@ -131,7 +131,7 @@ |
||
131 | 131 | public function name($name) |
132 | 132 | { |
133 | 133 | if(in_array($name,$this->name)){ |
134 | - $this->setError('You have written the '.$name.' name more than 1.'); |
|
134 | + $this->setError('You have written the '.$name.' name more than 1.'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $this->name[] = $name; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @var array |
27 | 27 | */ |
28 | - protected $auto_increment=array(); |
|
28 | + protected $auto_increment = array(); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @var $collation |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @var array $primaryKey |
42 | 42 | */ |
43 | - protected $primaryKey=array(); |
|
43 | + protected $primaryKey = array(); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var array $references |
47 | 47 | */ |
48 | - protected $references=array(); |
|
48 | + protected $references = array(); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @var $schemaType |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * @var $name array |
62 | 62 | */ |
63 | - protected $name=array(); |
|
63 | + protected $name = array(); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * @var array $nullable |
67 | 67 | */ |
68 | - protected $nullable=array(); |
|
68 | + protected $nullable = array(); |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * @var array $types |
72 | 72 | */ |
73 | - protected $types=array(); |
|
73 | + protected $types = array(); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * @var $engine |
@@ -80,17 +80,17 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * @var $default array |
82 | 82 | */ |
83 | - protected $default=array(); |
|
83 | + protected $default = array(); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @var array $index |
87 | 87 | */ |
88 | - protected $index=array(); |
|
88 | + protected $index = array(); |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @var array $unique |
92 | 92 | */ |
93 | - protected $unique=array(); |
|
93 | + protected $unique = array(); |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * @var $table |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function auto_increment() |
104 | 104 | { |
105 | - if(count($this->auto_increment)==0){ |
|
105 | + if (count($this->auto_increment)==0) { |
|
106 | 106 | |
107 | - if($this->getLastName()===false){ |
|
108 | - $this->name[]='id'; |
|
109 | - $this->setTypes('int',14); |
|
107 | + if ($this->getLastName()===false) { |
|
108 | + $this->name[] = 'id'; |
|
109 | + $this->setTypes('int', 14); |
|
110 | 110 | } |
111 | - $this->auto_increment[$this->getLastName()]=true; |
|
111 | + $this->auto_increment[$this->getLastName()] = true; |
|
112 | 112 | $this->primaryKey(); |
113 | 113 | } |
114 | 114 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function comment($value) |
121 | 121 | { |
122 | - $this->comment[$this->getLastName()]=$value; |
|
122 | + $this->comment[$this->getLastName()] = $value; |
|
123 | 123 | |
124 | 124 | return $this; |
125 | 125 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function name($name) |
132 | 132 | { |
133 | - if(in_array($name,$this->name)){ |
|
133 | + if (in_array($name, $this->name)) { |
|
134 | 134 | $this->setError('You have written the '.$name.' name more than 1.'); |
135 | 135 | } |
136 | 136 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function default($value) |
148 | 148 | { |
149 | - $this->default[$this->getLastName()]=$value; |
|
149 | + $this->default[$this->getLastName()] = $value; |
|
150 | 150 | |
151 | 151 | return $this; |
152 | 152 | } |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | * @param bool $table |
157 | 157 | * @return $this |
158 | 158 | */ |
159 | - public function collation($value,$table=false) |
|
159 | + public function collation($value, $table = false) |
|
160 | 160 | { |
161 | - if($table===false) |
|
161 | + if ($table===false) |
|
162 | 162 | { |
163 | - $this->collation[$this->getLastName()]=$value; |
|
163 | + $this->collation[$this->getLastName()] = $value; |
|
164 | 164 | } |
165 | - else{ |
|
166 | - $this->collation['table']=$value; |
|
165 | + else { |
|
166 | + $this->collation['table'] = $value; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return $this; |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | * @param bool $key |
176 | 176 | * @return $this|WizardContract |
177 | 177 | */ |
178 | - public function index($name=null,$value=null,$key=false) |
|
178 | + public function index($name = null, $value = null, $key = false) |
|
179 | 179 | { |
180 | 180 | $name = ($name===null) ? $this->getLastName() : $name; |
181 | 181 | $value = ($value===null) ? $name : $value; |
182 | 182 | |
183 | - if($key===false){ |
|
184 | - $this->index[$this->getLastName()]=['name'=>$name,'value'=>$value]; |
|
183 | + if ($key===false) { |
|
184 | + $this->index[$this->getLastName()] = ['name'=>$name, 'value'=>$value]; |
|
185 | 185 | } |
186 | 186 | |
187 | - if($key===true){ |
|
188 | - $this->index['indexes'][]=['name'=>$name,'value'=>$value]; |
|
187 | + if ($key===true) { |
|
188 | + $this->index['indexes'][] = ['name'=>$name, 'value'=>$value]; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | return $this; |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | * @param bool $null |
196 | 196 | * @return $this |
197 | 197 | */ |
198 | - public function nullable($null=true) |
|
198 | + public function nullable($null = true) |
|
199 | 199 | { |
200 | - $this->nullable[$this->getLastName()]=$null; |
|
200 | + $this->nullable[$this->getLastName()] = $null; |
|
201 | 201 | |
202 | 202 | return $this; |
203 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function primaryKey() |
209 | 209 | { |
210 | - $this->primaryKey[$this->getLastName()]=true; |
|
210 | + $this->primaryKey[$this->getLastName()] = true; |
|
211 | 211 | |
212 | 212 | return $this; |
213 | 213 | } |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | * @param null $value |
226 | 226 | * @return $this|mixed |
227 | 227 | */ |
228 | - public function unique($name=null,$value=null) |
|
228 | + public function unique($name = null, $value = null) |
|
229 | 229 | { |
230 | 230 | $name = ($name===null) ? $this->getLastName() : $name; |
231 | 231 | $value = ($value===null) ? $name : $value; |
232 | 232 | |
233 | - $this->unique[$this->getLastName()]=['name'=>$name,'value'=>$value]; |
|
233 | + $this->unique[$this->getLastName()] = ['name'=>$name, 'value'=>$value]; |
|
234 | 234 | |
235 | 235 | return $this; |
236 | 236 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct($wizard) |
26 | 26 | { |
27 | - $this->wizard=$wizard; |
|
27 | + $this->wizard = $wizard; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function constraint($constraint) |
35 | 35 | { |
36 | - $this->constraint=$constraint; |
|
36 | + $this->constraint = $constraint; |
|
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | $table = $this->wizard->getTable(); |
49 | 49 | |
50 | - $this->wizard->setReferences($constraint,'key',$key); |
|
50 | + $this->wizard->setReferences($constraint, 'key', $key); |
|
51 | 51 | |
52 | - return new References($this->wizard,$constraint); |
|
52 | + return new References($this->wizard, $constraint); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | * @param $wizard |
22 | 22 | * @param $constraint |
23 | 23 | */ |
24 | - public function __construct($wizard,$constraint) |
|
24 | + public function __construct($wizard, $constraint) |
|
25 | 25 | { |
26 | - $this->wizard=$wizard; |
|
27 | - $this->constraint=$constraint; |
|
26 | + $this->wizard = $wizard; |
|
27 | + $this->constraint = $constraint; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function references($table, $field = 'id') |
36 | 36 | { |
37 | - $this->wizard->setReferences($this->constraint,'references', |
|
37 | + $this->wizard->setReferences($this->constraint, 'references', |
|
38 | 38 | [ |
39 | 39 | 'table'=>$table, |
40 | 40 | 'field'=>$field |
41 | 41 | ]); |
42 | 42 | |
43 | - return new Options($this->wizard,$this->constraint); |
|
43 | + return new Options($this->wizard, $this->constraint); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | \ No newline at end of file |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | * @param $wizard |
22 | 22 | * @param $constraint |
23 | 23 | */ |
24 | - public function __construct($wizard,$constraint) |
|
24 | + public function __construct($wizard, $constraint) |
|
25 | 25 | { |
26 | - $this->wizard=$wizard; |
|
27 | - $this->constraint=$constraint; |
|
26 | + $this->wizard = $wizard; |
|
27 | + $this->constraint = $constraint; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function cascade() |
34 | 34 | { |
35 | - $this->wizard->setReferences($this->constraint,'onOption',__FUNCTION__); |
|
35 | + $this->wizard->setReferences($this->constraint, 'onOption', __FUNCTION__); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function noAction() |
42 | 42 | { |
43 | - $this->wizard->setReferences($this->constraint,'onOption',__FUNCTION__); |
|
43 | + $this->wizard->setReferences($this->constraint, 'onOption', __FUNCTION__); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function restrict() |
50 | 50 | { |
51 | - $this->wizard->setReferences($this->constraint,'onOption',__FUNCTION__); |
|
51 | + $this->wizard->setReferences($this->constraint, 'onOption', __FUNCTION__); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function setDefault() |
58 | 58 | { |
59 | - $this->wizard->setReferences($this->constraint,'onOption',__FUNCTION__); |
|
59 | + $this->wizard->setReferences($this->constraint, 'onOption', __FUNCTION__); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function setNull() |
66 | 66 | { |
67 | - $this->wizard->setReferences($this->constraint,'onOption',__FUNCTION__); |
|
67 | + $this->wizard->setReferences($this->constraint, 'onOption', __FUNCTION__); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | * @param $wizard |
22 | 22 | * @param $constraint |
23 | 23 | */ |
24 | - public function __construct($wizard,$constraint) |
|
24 | + public function __construct($wizard, $constraint) |
|
25 | 25 | { |
26 | - $this->wizard=$wizard; |
|
27 | - $this->constraint=$constraint; |
|
26 | + $this->wizard = $wizard; |
|
27 | + $this->constraint = $constraint; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function onDelete() |
34 | 34 | { |
35 | - $this->wizard->setReferences($this->constraint,'on','ON DELETE'); |
|
36 | - return new OptionsProperties($this->wizard,$this->constraint); |
|
35 | + $this->wizard->setReferences($this->constraint, 'on', 'ON DELETE'); |
|
36 | + return new OptionsProperties($this->wizard, $this->constraint); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function onUpdate() |
43 | 43 | { |
44 | - $this->wizard->setReferences($this->constraint,'on','ON UPDATE'); |
|
45 | - return new OptionsProperties($this->wizard,$this->constraint); |
|
44 | + $this->wizard->setReferences($this->constraint, 'on', 'ON UPDATE'); |
|
45 | + return new OptionsProperties($this->wizard, $this->constraint); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function setError($message) |
120 | 120 | { |
121 | - $this->error[]=$message; |
|
121 | + $this->error[] = $message; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function setEngine($engine) |
128 | 128 | { |
129 | - $this->engine=$engine; |
|
129 | + $this->engine = $engine; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function setName($name) |
136 | 136 | { |
137 | - $this->name[]=$name; |
|
137 | + $this->name[] = $name; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | * @param $key |
150 | 150 | * @param $value |
151 | 151 | */ |
152 | - public function setAlterType($key,$value) |
|
152 | + public function setAlterType($key, $value) |
|
153 | 153 | { |
154 | - $this->alterType[$key]=$value; |
|
154 | + $this->alterType[$key] = $value; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function setTable($table) |
161 | 161 | { |
162 | - $this->table=$table; |
|
162 | + $this->table = $table; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function schemaType($schemaType) |
169 | 169 | { |
170 | - $this->schemaType=$schemaType; |
|
170 | + $this->schemaType = $schemaType; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | * @param null $value |
176 | 176 | * @param null $cond |
177 | 177 | */ |
178 | - public function setTypes($type,$value=null,$cond=null) |
|
178 | + public function setTypes($type, $value = null, $cond = null) |
|
179 | 179 | { |
180 | - if(!is_array($value) && $value!==null){ |
|
181 | - $this->types[]=''.$type.'('.$value.')'; |
|
180 | + if (!is_array($value) && $value!==null) { |
|
181 | + $this->types[] = ''.$type.'('.$value.')'; |
|
182 | 182 | } |
183 | - else{ |
|
183 | + else { |
|
184 | 184 | |
185 | - if($cond=='enum'){ |
|
186 | - $this->types[]="".$type."('".implode("','",$value)."')"; |
|
185 | + if ($cond=='enum') { |
|
186 | + $this->types[] = "".$type."('".implode("','", $value)."')"; |
|
187 | 187 | } |
188 | - else{ |
|
189 | - $this->types[]=''.$type.''; |
|
188 | + else { |
|
189 | + $this->types[] = ''.$type.''; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * @return mixed |
198 | 198 | */ |
199 | - protected function getLastName(){ |
|
199 | + protected function getLastName() { |
|
200 | 200 | |
201 | 201 | return end($this->name); |
202 | 202 | } |
@@ -222,14 +222,14 @@ discard block |
||
222 | 222 | * @param $data |
223 | 223 | * @param string $specialist |
224 | 224 | */ |
225 | - public function updateIndexesForSpecialist($name,$data,$specialist='type') |
|
225 | + public function updateIndexesForSpecialist($name, $data, $specialist = 'type') |
|
226 | 226 | { |
227 | 227 | $indexes = $this->getIndex(); |
228 | 228 | |
229 | - foreach ($indexes['indexes'] as $key=>$index){ |
|
229 | + foreach ($indexes['indexes'] as $key=>$index) { |
|
230 | 230 | |
231 | - if($index['name']==$name){ |
|
232 | - $this->index['indexes'][$key][$specialist]=$data; |
|
231 | + if ($index['name']==$name) { |
|
232 | + $this->index['indexes'][$key][$specialist] = $data; |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | } |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | * @param $key |
240 | 240 | * @param $value |
241 | 241 | */ |
242 | - public function setReferences($constraint,$key,$value) |
|
242 | + public function setReferences($constraint, $key, $value) |
|
243 | 243 | { |
244 | - $this->references[$constraint][$key]=$value; |
|
244 | + $this->references[$constraint][$key] = $value; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -179,13 +179,11 @@ |
||
179 | 179 | { |
180 | 180 | if(!is_array($value) && $value!==null){ |
181 | 181 | $this->types[]=''.$type.'('.$value.')'; |
182 | - } |
|
183 | - else{ |
|
182 | + } else{ |
|
184 | 183 | |
185 | 184 | if($cond=='enum'){ |
186 | 185 | $this->types[]="".$type."('".implode("','",$value)."')"; |
187 | - } |
|
188 | - else{ |
|
186 | + } else{ |
|
189 | 187 | $this->types[]=''.$type.''; |
190 | 188 | } |
191 | 189 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct($wizard) |
23 | 23 | { |
24 | - $this->wizard=$wizard; |
|
24 | + $this->wizard = $wizard; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function collation($value = 'utf8') |
32 | 32 | { |
33 | - $this->wizard->collation($value,'true'); |
|
33 | + $this->wizard->collation($value, 'true'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | * @param null $comment |
56 | 56 | * @return IndexPropertiesContract |
57 | 57 | */ |
58 | - public function indexes($index_name, $fields = array(),$comment=null) |
|
58 | + public function indexes($index_name, $fields = array(), $comment = null) |
|
59 | 59 | { |
60 | - $this->wizard->index($index_name,$fields,true); |
|
60 | + $this->wizard->index($index_name, $fields, true); |
|
61 | 61 | |
62 | - if($comment!==null) $this->wizard->updateIndexesForSpecialist($index_name,$comment,'comment'); |
|
62 | + if ($comment!==null) $this->wizard->updateIndexesForSpecialist($index_name, $comment, 'comment'); |
|
63 | 63 | |
64 | - return new IndexProperties($index_name,$this->wizard); |
|
64 | + return new IndexProperties($index_name, $this->wizard); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | } |
@@ -59,7 +59,9 @@ |
||
59 | 59 | { |
60 | 60 | $this->wizard->index($index_name,$fields,true); |
61 | 61 | |
62 | - if($comment!==null) $this->wizard->updateIndexesForSpecialist($index_name,$comment,'comment'); |
|
62 | + if($comment!==null) { |
|
63 | + $this->wizard->updateIndexesForSpecialist($index_name,$comment,'comment'); |
|
64 | + } |
|
63 | 65 | |
64 | 66 | return new IndexProperties($index_name,$this->wizard); |
65 | 67 | } |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * @var string |
14 | 14 | */ |
15 | - private $fieldKey='Field'; |
|
15 | + private $fieldKey = 'Field'; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @param $columns |
19 | 19 | */ |
20 | 20 | public function columnsProcess($columns) |
21 | 21 | { |
22 | - $this->columns=$columns; |
|
22 | + $this->columns = $columns; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param array $tables |
35 | 35 | * @return array |
36 | 36 | */ |
37 | - public function fields($tables=array()) |
|
37 | + public function fields($tables = array()) |
|
38 | 38 | { |
39 | 39 | $list = []; |
40 | 40 | |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | { |
43 | 43 | foreach ($columns as $columnData) |
44 | 44 | { |
45 | - if(count($tables)){ |
|
45 | + if (count($tables)) { |
|
46 | 46 | |
47 | - if(in_array($table,$tables)){ |
|
47 | + if (in_array($table, $tables)) { |
|
48 | 48 | $list[$table][] = $columnData[$this->fieldKey]; |
49 | 49 | } |
50 | 50 | } |
51 | - else{ |
|
51 | + else { |
|
52 | 52 | $list[$table][] = $columnData[$this->fieldKey]; |
53 | 53 | } |
54 | 54 | } |
@@ -47,8 +47,7 @@ |
||
47 | 47 | if(in_array($table,$tables)){ |
48 | 48 | $list[$table][] = $columnData[$this->fieldKey]; |
49 | 49 | } |
50 | - } |
|
51 | - else{ |
|
50 | + } else{ |
|
52 | 51 | $list[$table][] = $columnData[$this->fieldKey]; |
53 | 52 | } |
54 | 53 | } |
@@ -44,8 +44,7 @@ |
||
44 | 44 | 'query'=>$query, |
45 | 45 | 'message'=>null, |
46 | 46 | ]; |
47 | - } |
|
48 | - catch (\PDOException $exception){ |
|
47 | + } catch (\PDOException $exception){ |
|
49 | 48 | |
50 | 49 | return [ |
51 | 50 | 'result'=>false, |
@@ -17,13 +17,13 @@ |
||
17 | 17 | */ |
18 | 18 | public function showTables() |
19 | 19 | { |
20 | - $tables = $this->connection()->query('SHOW TABLES')->fetchAll(); |
|
20 | + $tables = $this->connection()->query('SHOW TABLES')->fetchAll(); |
|
21 | 21 | |
22 | - $list = []; |
|
22 | + $list = []; |
|
23 | 23 | |
24 | 24 | foreach ($tables as $key=>$table) { |
25 | 25 | $list[] = $table[0]; |
26 | - } |
|
26 | + } |
|
27 | 27 | |
28 | 28 | return $list; |
29 | 29 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $collation = $this->connection()->query('SHOW COLLATION LIKE \''.$collation.'%\'')->fetchAll(); |
52 | 52 | |
53 | - if(isset($collation[0])){ |
|
53 | + if (isset($collation[0])) { |
|
54 | 54 | return $collation[0]['Charset']; |
55 | 55 | } |
56 | 56 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $status = $this->connection()->query('show table status like \''.$table.'\'')->fetchAll(); |
69 | 69 | |
70 | - if(isset($status[0])){ |
|
70 | + if (isset($status[0])) { |
|
71 | 71 | return $status[0]; |
72 | 72 | } |
73 | 73 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | WHERE rc.CONSTRAINT_SCHEMA = \''.$database.'\' |
104 | 104 | AND rc.TABLE_NAME = \''.$table.'\' AND r.REFERENCED_TABLE_NAME is not null')->fetchAll(); |
105 | 105 | |
106 | - if(isset($query[0])){ |
|
106 | + if (isset($query[0])) { |
|
107 | 107 | return $query[0]; |
108 | 108 | } |
109 | 109 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | try { |
122 | 122 | |
123 | - $query =$this->connection()->query($query); |
|
123 | + $query = $this->connection()->query($query); |
|
124 | 124 | |
125 | 125 | return [ |
126 | 126 | 'result'=>true, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'message'=>null, |
129 | 129 | ]; |
130 | 130 | } |
131 | - catch (\PDOException $exception){ |
|
131 | + catch (\PDOException $exception) { |
|
132 | 132 | |
133 | 133 | return [ |
134 | 134 | 'result'=>false, |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function generateEntity($table) |
146 | 146 | { |
147 | - if(in_array($table,$this->showTables()) || in_array($table = strtolower($table),$this->showTables())){ |
|
147 | + if (in_array($table, $this->showTables()) || in_array($table = strtolower($table), $this->showTables())) { |
|
148 | 148 | |
149 | 149 | $entityDirectory = path()->model().''.DIRECTORY_SEPARATOR.'Entity'; |
150 | 150 | |
151 | - if(!file_exists($entityDirectory)){ |
|
151 | + if (!file_exists($entityDirectory)) { |
|
152 | 152 | files()->makeDirectory($entityDirectory); |
153 | 153 | } |
154 | 154 | |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | $list[] = $column['Field']; |
161 | 161 | } |
162 | 162 | |
163 | - if(!file_exists($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table))){ |
|
164 | - $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table),$table.''); |
|
163 | + if (!file_exists($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table))) { |
|
164 | + $generator = new Generator($entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table), $table.''); |
|
165 | 165 | |
166 | 166 | $generator->createClass(); |
167 | 167 | } |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | $abstractClassPath = $entityDirectory.''.DIRECTORY_SEPARATOR.''.ucfirst($table).''.DIRECTORY_SEPARATOR.'Entity'; |
171 | 171 | $abstractNamespace = Utils::getNamespace($abstractClassPath.''.DIRECTORY_SEPARATOR.''.ucfirst($table).'Abstract'); |
172 | 172 | |
173 | - $generator->createClassExtend($abstractNamespace,ucfirst($table).'Abstract'); |
|
173 | + $generator->createClassExtend($abstractNamespace, ucfirst($table).'Abstract'); |
|
174 | 174 | |
175 | - $generator = new Generator($abstractClassPath,$table.'Abstract'); |
|
175 | + $generator = new Generator($abstractClassPath, $table.'Abstract'); |
|
176 | 176 | |
177 | 177 | $generator->createClass(); |
178 | 178 | |
179 | - $method =array_merge([ |
|
179 | + $method = array_merge([ |
|
180 | 180 | '__construct' |
181 | - ],array_merge($list,['__get'])); |
|
181 | + ], array_merge($list, ['__get'])); |
|
182 | 182 | |
183 | 183 | $generator->createMethod($method); |
184 | 184 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | $generator->createClassDocument($createClassDocument); |
205 | 205 | |
206 | - $generator->createMethodDocument(array_merge($createMethodDocument,[ |
|
206 | + $generator->createMethodDocument(array_merge($createMethodDocument, [ |
|
207 | 207 | '__construct' => [ |
208 | 208 | ''.$table.' constructor.', |
209 | 209 | '@param null|object $query' |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $createMethodBody = array_merge([ |
220 | 220 | '__construct' => 'self::$query = $query;', |
221 | 221 | '__get' => 'return static::{$name}();' |
222 | - ],$methodBodyList); |
|
222 | + ], $methodBodyList); |
|
223 | 223 | |
224 | 224 | $generator->createMethodBody($createMethodBody); |
225 | 225 |