@@ -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 | } |
@@ -25,28 +25,28 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $this->getDefaultSyntaxGroup(); |
| 27 | 27 | |
| 28 | - $this->syntax[]=')'; |
|
| 28 | + $this->syntax[] = ')'; |
|
| 29 | 29 | |
| 30 | 30 | //get table collation |
| 31 | - if(isset($this->data['tableCollation']['table'])){ |
|
| 32 | - $this->syntax[]=' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table']; |
|
| 31 | + if (isset($this->data['tableCollation']['table'])) { |
|
| 32 | + $this->syntax[] = ' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table']; |
|
| 33 | 33 | } |
| 34 | - else{ |
|
| 35 | - $this->syntax[]=' DEFAULT CHARACTER SET utf8'; |
|
| 34 | + else { |
|
| 35 | + $this->syntax[] = ' DEFAULT CHARACTER SET utf8'; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | //get engine |
| 39 | - if($this->data['engine']!==null) |
|
| 39 | + if ($this->data['engine']!==null) |
|
| 40 | 40 | { |
| 41 | - $this->syntax[]=' ENGINE='.$this->data['engine'].' '; |
|
| 41 | + $this->syntax[] = ' ENGINE='.$this->data['engine'].' '; |
|
| 42 | 42 | } |
| 43 | - else{ |
|
| 44 | - $this->syntax[]=' ENGINE=InnoDB '; |
|
| 43 | + else { |
|
| 44 | + $this->syntax[] = ' ENGINE=InnoDB '; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $syntax = implode("",$this->syntax); |
|
| 47 | + $syntax = implode("", $this->syntax); |
|
| 48 | 48 | |
| 49 | - $query=$this->schema->getConnection()->setQueryBasic($syntax); |
|
| 49 | + $query = $this->schema->getConnection()->setQueryBasic($syntax); |
|
| 50 | 50 | |
| 51 | 51 | return [ |
| 52 | 52 | 'syntax'=>$syntax, |
@@ -62,25 +62,25 @@ discard block |
||
| 62 | 62 | private function getDefaultSyntaxGroup() |
| 63 | 63 | { |
| 64 | 64 | |
| 65 | - $this->syntax[]=implode(",",$this->getCreateDefaultList()); |
|
| 65 | + $this->syntax[] = implode(",", $this->getCreateDefaultList()); |
|
| 66 | 66 | |
| 67 | 67 | //get unique values |
| 68 | - if(isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])){ |
|
| 69 | - $this->syntax[]=','.implode(',',$this->data['uniqueValueList']); |
|
| 68 | + if (isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])) { |
|
| 69 | + $this->syntax[] = ','.implode(',', $this->data['uniqueValueList']); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | //get index values |
| 73 | - if(isset($this->data['indexValueList']) && count($this->data['indexValueList'])){ |
|
| 74 | - $this->syntax[]=','.implode(',',$this->data['indexValueList']); |
|
| 73 | + if (isset($this->data['indexValueList']) && count($this->data['indexValueList'])) { |
|
| 74 | + $this->syntax[] = ','.implode(',', $this->data['indexValueList']); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | //get index values for key |
| 78 | - if(count($this->getKeyList())){ |
|
| 79 | - $this->syntax[]=','.implode(',',$this->getKeyList()); |
|
| 78 | + if (count($this->getKeyList())) { |
|
| 79 | + $this->syntax[] = ','.implode(',', $this->getKeyList()); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if(count($this->data['references'])){ |
|
| 83 | - $this->syntax[]=$this->getReferenceSyntax($this->data['references']); |
|
| 82 | + if (count($this->data['references'])) { |
|
| 83 | + $this->syntax[] = $this->getReferenceSyntax($this->data['references']); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -104,17 +104,17 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | private function addColumn($alterType) |
| 106 | 106 | { |
| 107 | - if(isset($alterType['place'])){ |
|
| 107 | + if (isset($alterType['place'])) { |
|
| 108 | 108 | |
| 109 | - foreach ($alterType['place'] as $placeKey=>$placeValue){ |
|
| 110 | - $placeList=$placeKey .' '.$placeValue.''; |
|
| 109 | + foreach ($alterType['place'] as $placeKey=>$placeValue) { |
|
| 110 | + $placeList = $placeKey.' '.$placeValue.''; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $syntax = implode("",$this->syntax); |
|
| 113 | + $syntax = implode("", $this->syntax); |
|
| 114 | 114 | |
| 115 | 115 | $alterSytanx = 'ALTER TABLE '.$this->table.' ADD COLUMN '.$syntax.' '.$placeList; |
| 116 | 116 | |
| 117 | - $query=$this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 117 | + $query = $this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
| 118 | 118 | |
| 119 | 119 | return [ |
| 120 | 120 | 'syntax'=>$syntax, |
@@ -30,8 +30,7 @@ discard block |
||
| 30 | 30 | //get table collation |
| 31 | 31 | if(isset($this->data['tableCollation']['table'])){ |
| 32 | 32 | $this->syntax[]=' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table']; |
| 33 | - } |
|
| 34 | - else{ |
|
| 33 | + } else{ |
|
| 35 | 34 | $this->syntax[]=' DEFAULT CHARACTER SET utf8'; |
| 36 | 35 | } |
| 37 | 36 | |
@@ -39,8 +38,7 @@ discard block |
||
| 39 | 38 | if($this->data['engine']!==null) |
| 40 | 39 | { |
| 41 | 40 | $this->syntax[]=' ENGINE='.$this->data['engine'].' '; |
| 42 | - } |
|
| 43 | - else{ |
|
| 41 | + } else{ |
|
| 44 | 42 | $this->syntax[]=' ENGINE=InnoDB '; |
| 45 | 43 | } |
| 46 | 44 | |
@@ -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 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function showTables() |
| 19 | 19 | { |
| 20 | - return $this->connection()->query('SHOW TABLES')->fetchAll(); |
|
| 20 | + return $this->connection()->query('SHOW TABLES')->fetchAll(); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | try { |
| 39 | 39 | |
| 40 | - $query =$this->connection()->query($query); |
|
| 40 | + $query = $this->connection()->query($query); |
|
| 41 | 41 | |
| 42 | 42 | return [ |
| 43 | 43 | 'result'=>true, |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | 'message'=>null, |
| 46 | 46 | ]; |
| 47 | 47 | } |
| 48 | - catch (\PDOException $exception){ |
|
| 48 | + catch (\PDOException $exception) { |
|
| 49 | 49 | |
| 50 | 50 | return [ |
| 51 | 51 | 'result'=>false, |
@@ -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, |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class QueryBase implements QueryBaseContract |
| 11 | 11 | { |
| 12 | - use QueryStack,ColumnsProcess; |
|
| 12 | + use QueryStack, ColumnsProcess; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * @return mixed |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $list = []; |
| 30 | 30 | |
| 31 | - foreach ($tables as $key=>$resource){ |
|
| 31 | + foreach ($tables as $key=>$resource) { |
|
| 32 | 32 | |
| 33 | 33 | $list[$key] = $resource[0]; |
| 34 | 34 | } |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | * @param array $tables |
| 41 | 41 | * @return ColumnsProcessContract |
| 42 | 42 | */ |
| 43 | - public function getColumns($tables=array()) |
|
| 43 | + public function getColumns($tables = array()) |
|
| 44 | 44 | { |
| 45 | 45 | $tableList = (count($tables)) ? $tables : $this->getTables(); |
| 46 | 46 | |
| 47 | 47 | $list = []; |
| 48 | 48 | |
| 49 | - foreach ($tableList as $table){ |
|
| 49 | + foreach ($tableList as $table) { |
|
| 50 | 50 | |
| 51 | - if(in_array($table,$this->getTables())){ |
|
| 51 | + if (in_array($table, $this->getTables())) { |
|
| 52 | 52 | $list[$table] = $this->showColumnsFrom($table); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -10,16 +10,16 @@ discard block |
||
| 10 | 10 | * @param $name |
| 11 | 11 | * @return string |
| 12 | 12 | */ |
| 13 | - protected function getNullableValue($nullable,$name) |
|
| 13 | + protected function getNullableValue($nullable, $name) |
|
| 14 | 14 | { |
| 15 | - $nullableValue=''; |
|
| 15 | + $nullableValue = ''; |
|
| 16 | 16 | |
| 17 | - if(isset($nullable[$name])){ |
|
| 18 | - if($nullable[$name]===false){ |
|
| 19 | - $nullableValue='NOT NULL'; |
|
| 17 | + if (isset($nullable[$name])) { |
|
| 18 | + if ($nullable[$name]===false) { |
|
| 19 | + $nullableValue = 'NOT NULL'; |
|
| 20 | 20 | } |
| 21 | - else{ |
|
| 22 | - $nullableValue='NULL'; |
|
| 21 | + else { |
|
| 22 | + $nullableValue = 'NULL'; |
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | protected function getValueWithIsset($name) |
| 61 | 61 | { |
| 62 | 62 | $list = []; |
| 63 | - $list[] = $this->getNullableValue($this->data['nullable'],$name); |
|
| 63 | + $list[] = $this->getNullableValue($this->data['nullable'], $name); |
|
| 64 | 64 | $list[] = (isset($this->data['autoIncrement'][$name])) ? 'AUTO_INCREMENT' : ''; |
| 65 | 65 | $list[] = (isset($this->data['primaryKey'][$name])) ? 'PRIMARY KEY' : ''; |
| 66 | 66 | $list[] = (isset($this->data['default'][$name])) ? ' DEFAULT "'.$this->data['default'][$name].'"' : ''; |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | protected function getUniqueValueList($name) |
| 78 | 78 | { |
| 79 | 79 | //get unique |
| 80 | - if(isset($this->data['unique'][$name])){ |
|
| 81 | - $this->data['uniqueValueList'][] = 'UNIQUE INDEX '.$this->data['unique'][$name]['name'].' ('.$this->data['unique'][$name]['value'].' ASC)'; |
|
| 80 | + if (isset($this->data['unique'][$name])) { |
|
| 81 | + $this->data['uniqueValueList'][] = 'UNIQUE INDEX '.$this->data['unique'][$name]['name'].' ('.$this->data['unique'][$name]['value'].' ASC)'; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | protected function getIndexValueList($name) |
| 89 | 89 | { |
| 90 | 90 | //get index |
| 91 | - if(isset($this->data['index'][$name])){ |
|
| 92 | - $this->data['indexValueList'][] = 'INDEX '.$this->data['index'][$name]['name'].' ('.$this->data['index'][$name]['value'].')'; |
|
| 91 | + if (isset($this->data['index'][$name])) { |
|
| 92 | + $this->data['indexValueList'][] = 'INDEX '.$this->data['index'][$name]['name'].' ('.$this->data['index'][$name]['value'].')'; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -110,19 +110,19 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | protected function getCreateDefaultList() |
| 112 | 112 | { |
| 113 | - $list = []; |
|
| 113 | + $list = []; |
|
| 114 | 114 | |
| 115 | 115 | foreach ($this->data['names'] as $key=>$name) |
| 116 | 116 | { |
| 117 | 117 | list( |
| 118 | - $nullableValue,$autoIncrementValue, |
|
| 119 | - $primaryKeyValue,$defaultValue,$commentValue |
|
| 118 | + $nullableValue, $autoIncrementValue, |
|
| 119 | + $primaryKeyValue, $defaultValue, $commentValue |
|
| 120 | 120 | ) = $this->getValueWithIsset($name); |
| 121 | 121 | |
| 122 | 122 | //set index values |
| 123 | 123 | $this->setIndex($name); |
| 124 | 124 | |
| 125 | - $list[]=''.$name.' '.$this->data['types'][$key].' '.$nullableValue.' '.$defaultValue.' '.$primaryKeyValue.' '.$autoIncrementValue.' '.$commentValue.''; |
|
| 125 | + $list[] = ''.$name.' '.$this->data['types'][$key].' '.$nullableValue.' '.$defaultValue.' '.$primaryKeyValue.' '.$autoIncrementValue.' '.$commentValue.''; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | return $list; |
@@ -133,18 +133,18 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | protected function getKeyList() |
| 135 | 135 | { |
| 136 | - $keyList = []; |
|
| 136 | + $keyList = []; |
|
| 137 | 137 | |
| 138 | 138 | //multiple indexes |
| 139 | - if(isset($this->data['index']['indexes'])){ |
|
| 139 | + if (isset($this->data['index']['indexes'])) { |
|
| 140 | 140 | |
| 141 | - foreach ($this->data['index']['indexes'] as $index_key=>$index_value){ |
|
| 141 | + foreach ($this->data['index']['indexes'] as $index_key=>$index_value) { |
|
| 142 | 142 | |
| 143 | 143 | $indexesCommentValue = (isset($index_value['comment'])) ? 'COMMENT "'.$index_value['comment'].'"' : ''; |
| 144 | 144 | |
| 145 | 145 | $keyType = (isset($index_value['type'])) ? ucfirst($index_value['type']) : 'KEY'; |
| 146 | 146 | |
| 147 | - $keyList[] = "".$keyType." ".$index_value['name']." (".implode(",",$index_value['value']).") ".$indexesCommentValue; |
|
| 147 | + $keyList[] = "".$keyType." ".$index_value['name']." (".implode(",", $index_value['value']).") ".$indexesCommentValue; |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
@@ -159,13 +159,13 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | $list = []; |
| 161 | 161 | |
| 162 | - foreach ($reference as $constraint=>$values){ |
|
| 162 | + foreach ($reference as $constraint=>$values) { |
|
| 163 | 163 | |
| 164 | - $list[]=',CONSTRAINT '.$constraint.' FOREIGN KEY ('.$values['key'].') |
|
| 164 | + $list[] = ',CONSTRAINT '.$constraint.' FOREIGN KEY ('.$values['key'].') |
|
| 165 | 165 | REFERENCES '.$values['references']['table'].'('.$values['references']['field'].') '.$this->getOnProcess($values); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - return implode (" ",$list); |
|
| 168 | + return implode(" ", $list); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | private function getOnProcess($referenceValue) |
| 175 | 175 | { |
| 176 | - if(isset($referenceValue['on']) && isset($referenceValue['onOption'])){ |
|
| 176 | + if (isset($referenceValue['on']) && isset($referenceValue['onOption'])) { |
|
| 177 | 177 | return ''.$referenceValue['on'].' '.strtoupper($referenceValue['onOption']).''; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -17,8 +17,7 @@ |
||
| 17 | 17 | if(isset($nullable[$name])){ |
| 18 | 18 | if($nullable[$name]===false){ |
| 19 | 19 | $nullableValue='NOT NULL'; |
| 20 | - } |
|
| 21 | - else{ |
|
| 20 | + } else{ |
|
| 22 | 21 | $nullableValue='NULL'; |
| 23 | 22 | } |
| 24 | 23 | } |
@@ -15,22 +15,22 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function get() |
| 17 | 17 | { |
| 18 | - BaseRequestProcess::$paths=$this->config['paths']; |
|
| 18 | + BaseRequestProcess::$paths = $this->config['paths']; |
|
| 19 | 19 | |
| 20 | 20 | $allFiles = BaseRequestProcess::getAllFiles(); |
| 21 | 21 | |
| 22 | - foreach ($allFiles as $table=>$files){ |
|
| 22 | + foreach ($allFiles as $table=>$files) { |
|
| 23 | 23 | |
| 24 | 24 | foreach ($files as $file) { |
| 25 | 25 | |
| 26 | - $className = str_replace(".php","",BaseRequestProcess::getFileName($file)); |
|
| 26 | + $className = str_replace(".php", "", BaseRequestProcess::getFileName($file)); |
|
| 27 | 27 | $className = ucfirst($className); |
| 28 | 28 | |
| 29 | 29 | $require = require_once ($file); |
| 30 | 30 | |
| 31 | 31 | $up = new $className; |
| 32 | 32 | |
| 33 | - $capsule = new SchemaCapsule($this->config,$file); |
|
| 33 | + $capsule = new SchemaCapsule($this->config, $file); |
|
| 34 | 34 | |
| 35 | 35 | dd($up->up($capsule)); |
| 36 | 36 | } |
@@ -13,19 +13,19 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | $results = []; |
| 15 | 15 | |
| 16 | - return $this->errorHandler(function(){ |
|
| 16 | + return $this->errorHandler(function() { |
|
| 17 | 17 | |
| 18 | - foreach ($this->list as $table =>$datas){ |
|
| 18 | + foreach ($this->list as $table =>$datas) { |
|
| 19 | 19 | |
| 20 | - foreach ($datas as $data){ |
|
| 20 | + foreach ($datas as $data) { |
|
| 21 | 21 | |
| 22 | 22 | $queryBuilder = $this->schema->getGrammarPath().'\QueryBuilder'; |
| 23 | 23 | |
| 24 | - $query = (new $queryBuilder($this->schema,$table,$data))->handle(); |
|
| 24 | + $query = (new $queryBuilder($this->schema, $table, $data))->handle(); |
|
| 25 | 25 | |
| 26 | - $status =($query['result']!==false) ? true : false; |
|
| 26 | + $status = ($query['result']!==false) ? true : false; |
|
| 27 | 27 | |
| 28 | - $results[]= [ |
|
| 28 | + $results[] = [ |
|
| 29 | 29 | 'success'=>$status, |
| 30 | 30 | 'file'=>$data->getFile(), |
| 31 | 31 | 'table'=>$table, |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | foreach ($objects as $object) |
| 51 | 51 | { |
| 52 | - if(count($object->getError())){ |
|
| 52 | + if (count($object->getError())) { |
|
| 53 | 53 | return 'error : '.$object->getFile().' -> '.$object->getError()[0].''; |
| 54 | 54 | } |
| 55 | 55 | } |