@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | //the auto service to be called. |
28 | 28 | return ClosureDispatcher::bind($controllerInstance)->call(function() use($controllerInstance){ |
29 | 29 | |
30 | - if(property_exists($controllerInstance,'response')){ |
|
30 | + if (property_exists($controllerInstance, 'response')) { |
|
31 | 31 | return $controllerInstance->response; |
32 | 32 | } |
33 | 33 | |
34 | 34 | // if the client wishes, |
35 | 35 | // data can be returned in the supported format. |
36 | - if($this->app->has('clientResponseType')){ |
|
36 | + if ($this->app->has('clientResponseType')) { |
|
37 | 37 | return $this->app->get('clientResponseType'); |
38 | 38 | } |
39 | 39 | |
@@ -73,8 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | //we get the response type by checking the instanceController object from the router. |
75 | 75 | //Each type of response is in the base class in project directory. |
76 | - return ($this->getControllerInstance()===null) ? core()->responseType : |
|
77 | - $this->appResponseType(); |
|
76 | + return ($this->getControllerInstance()===null) ? core()->responseType : $this->appResponseType(); |
|
78 | 77 | } |
79 | 78 | |
80 | 79 | /** |
@@ -85,19 +84,19 @@ discard block |
||
85 | 84 | public function handle() |
86 | 85 | { |
87 | 86 | //definition for singleton instance |
88 | - define ('responseApp',true); |
|
87 | + define('responseApp', true); |
|
89 | 88 | |
90 | 89 | //get out putter for response |
91 | 90 | $formatter = $this->formatter(); |
92 | 91 | |
93 | 92 | //if out putter is not null |
94 | - if(Utils::isNamespaceExists($formatter)){ |
|
93 | + if (Utils::isNamespaceExists($formatter)) { |
|
95 | 94 | |
96 | 95 | //We resolve the response via the service container |
97 | 96 | //and run the handle method. |
98 | 97 | $result = app()->resolve($formatter)->{$this->getResponseKind()}($this->getOutPutter()); |
99 | 98 | |
100 | - $this->app->register('result',$result); |
|
99 | + $this->app->register('result', $result); |
|
101 | 100 | } |
102 | 101 | } |
103 | 102 | |
@@ -107,7 +106,7 @@ discard block |
||
107 | 106 | * @param array $data |
108 | 107 | * @return array |
109 | 108 | */ |
110 | - public function outputFormatter($data=array()) |
|
109 | + public function outputFormatter($data = array()) |
|
111 | 110 | { |
112 | 111 | $dataCapsule = config('response.data'); |
113 | 112 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @var $type |
17 | 17 | */ |
18 | - public $type='migration'; |
|
18 | + public $type = 'migration'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var array |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var $commandRule |
35 | 35 | */ |
36 | - public $commandRule=['create'=>[ |
|
37 | - 'name','table' |
|
36 | + public $commandRule = ['create'=>[ |
|
37 | + 'name', 'table' |
|
38 | 38 | ], |
39 | 39 | 'push'=>[]]; |
40 | 40 | |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | |
64 | 64 | foreach ($pushResult as $key=>$value) { |
65 | 65 | |
66 | - if(isset($value['success'])){ |
|
66 | + if (isset($value['success'])) { |
|
67 | 67 | |
68 | 68 | $list[] = true; |
69 | 69 | |
70 | - $pushResultFile = explode("/",$pushResult[$key]['file']); |
|
70 | + $pushResultFile = explode("/", $pushResult[$key]['file']); |
|
71 | 71 | $file = end($pushResultFile); |
72 | 72 | |
73 | - if($pushResult[$key]['success']===true){ |
|
73 | + if ($pushResult[$key]['success']===true) { |
|
74 | 74 | |
75 | 75 | $this->table->addRow([ |
76 | 76 | $key, |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'No', |
83 | 83 | ]); |
84 | 84 | } |
85 | - else{ |
|
85 | + else { |
|
86 | 86 | |
87 | 87 | $this->table->addRow([ |
88 | 88 | $key, |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - if(count($list)){ |
|
102 | - $this->table->setHeaders(['id','table','file','type','status','message','seeder']); |
|
101 | + if (count($list)) { |
|
102 | + $this->table->setHeaders(['id', 'table', 'file', 'type', 'status', 'message', 'seeder']); |
|
103 | 103 | |
104 | 104 | echo $this->table->getTable(); |
105 | 105 | } |
106 | - else{ |
|
106 | + else { |
|
107 | 107 | echo $this->classical('No migration was found to apply'); |
108 | 108 | } |
109 | 109 | |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | |
125 | 125 | $stubType = (!file_exists($tablePath)) ? 'create' : 'alter'; |
126 | 126 | |
127 | - if(!file_exists($path)){ |
|
127 | + if (!file_exists($path)) { |
|
128 | 128 | |
129 | - $this->file->fs->mkdir($path,0777); |
|
130 | - $this->file->fs->chmod($path,0777,000,true); |
|
129 | + $this->file->fs->mkdir($path, 0777); |
|
130 | + $this->file->fs->chmod($path, 0777, 000, true); |
|
131 | 131 | } |
132 | 132 | |
133 | - $migrationCreate = $this->getSchema()->stub($this->argument['table'],$this->argument['name'],$stubType); |
|
133 | + $migrationCreate = $this->getSchema()->stub($this->argument['table'], $this->argument['name'], $stubType); |
|
134 | 134 | |
135 | 135 | echo $this->info('Migration Create Process :'); |
136 | 136 | |
137 | - $this->table->setHeaders(['id','method','table','style','name','type','status','message']); |
|
137 | + $this->table->setHeaders(['id', 'method', 'table', 'style', 'name', 'type', 'status', 'message']); |
|
138 | 138 | |
139 | - foreach ($migrationCreate['directory'] as $key=>$data){ |
|
139 | + foreach ($migrationCreate['directory'] as $key=>$data) { |
|
140 | 140 | |
141 | 141 | $this->table->addRow([ |
142 | 142 | $key, |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | ]); |
152 | 152 | } |
153 | 153 | |
154 | - foreach ($migrationCreate['file'] as $key=>$data){ |
|
154 | + foreach ($migrationCreate['file'] as $key=>$data) { |
|
155 | 155 | |
156 | 156 | $this->table->addRow([ |
157 | 157 | $key, |
@@ -81,8 +81,7 @@ discard block |
||
81 | 81 | 'Ok', |
82 | 82 | 'No', |
83 | 83 | ]); |
84 | - } |
|
85 | - else{ |
|
84 | + } else{ |
|
86 | 85 | |
87 | 86 | $this->table->addRow([ |
88 | 87 | $key, |
@@ -102,8 +101,7 @@ discard block |
||
102 | 101 | $this->table->setHeaders(['id','table','file','type','status','message','seeder']); |
103 | 102 | |
104 | 103 | echo $this->table->getTable(); |
105 | - } |
|
106 | - else{ |
|
104 | + } else{ |
|
107 | 105 | echo $this->classical('No migration was found to apply'); |
108 | 106 | } |
109 | 107 |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function processHandler() |
13 | 13 | { |
14 | - return $this->errorHandler(function(){ |
|
14 | + return $this->errorHandler(function() { |
|
15 | 15 | |
16 | 16 | $results = []; |
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 | - $query = $this->queryBuilder($table,$data); |
|
22 | + $query = $this->queryBuilder($table, $data); |
|
23 | 23 | |
24 | 24 | $query = $query->handle(); |
25 | 25 | |
26 | - if($query===false){ |
|
26 | + if ($query===false) { |
|
27 | 27 | $results[] = []; |
28 | 28 | } |
29 | - else{ |
|
30 | - $status =($query['result']!==false) ? true : false; |
|
29 | + else { |
|
30 | + $status = ($query['result']!==false) ? true : false; |
|
31 | 31 | |
32 | - $results[]= [ |
|
32 | + $results[] = [ |
|
33 | 33 | 'success'=>$status, |
34 | 34 | 'file'=>$data->getFile(), |
35 | 35 | 'table'=>$table, |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | foreach ($objects as $object) |
59 | 59 | { |
60 | - if(count($object->getError())){ |
|
60 | + if (count($object->getError())) { |
|
61 | 61 | return 'error : '.$object->getFile().' -> '.$object->getError()[0].''; |
62 | 62 | } |
63 | 63 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | |
26 | 26 | if($query===false){ |
27 | 27 | $results[] = []; |
28 | - } |
|
29 | - else{ |
|
28 | + } else{ |
|
30 | 29 | $status =($query['result']!==false) ? true : false; |
31 | 30 | |
32 | 31 | $results[]= [ |
@@ -27,32 +27,32 @@ discard block |
||
27 | 27 | |
28 | 28 | $this->getDefaultSyntaxGroup(); |
29 | 29 | |
30 | - $this->syntax[]=')'; |
|
30 | + $this->syntax[] = ')'; |
|
31 | 31 | |
32 | 32 | //get table collation |
33 | - if(isset($this->data['tableCollation']['table'])){ |
|
34 | - $this->syntax[]=' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table']; |
|
33 | + if (isset($this->data['tableCollation']['table'])) { |
|
34 | + $this->syntax[] = ' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table']; |
|
35 | 35 | } |
36 | - else{ |
|
37 | - $this->syntax[]=' DEFAULT CHARACTER SET utf8'; |
|
36 | + else { |
|
37 | + $this->syntax[] = ' DEFAULT CHARACTER SET utf8'; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | //get engine |
41 | - if($this->data['engine']!==null) |
|
41 | + if ($this->data['engine']!==null) |
|
42 | 42 | { |
43 | - $this->syntax[]=' ENGINE='.$this->data['engine'].' '; |
|
43 | + $this->syntax[] = ' ENGINE='.$this->data['engine'].' '; |
|
44 | 44 | } |
45 | - else{ |
|
46 | - $this->syntax[]=' ENGINE=InnoDB '; |
|
45 | + else { |
|
46 | + $this->syntax[] = ' ENGINE=InnoDB '; |
|
47 | 47 | } |
48 | 48 | |
49 | - $syntax = implode("",$this->syntax); |
|
49 | + $syntax = implode("", $this->syntax); |
|
50 | 50 | |
51 | - if(in_array($this->table,$existTables)){ |
|
51 | + if (in_array($this->table, $existTables)) { |
|
52 | 52 | return false; |
53 | 53 | } |
54 | - else{ |
|
55 | - $query=$this->schema->getConnection()->setQueryBasic($syntax); |
|
54 | + else { |
|
55 | + $query = $this->schema->getConnection()->setQueryBasic($syntax); |
|
56 | 56 | |
57 | 57 | return [ |
58 | 58 | 'syntax'=>$syntax, |
@@ -70,25 +70,25 @@ discard block |
||
70 | 70 | private function getDefaultSyntaxGroup() |
71 | 71 | { |
72 | 72 | |
73 | - $this->syntax[]=implode(",",$this->getCreateDefaultList()); |
|
73 | + $this->syntax[] = implode(",", $this->getCreateDefaultList()); |
|
74 | 74 | |
75 | 75 | //get unique values |
76 | - if(isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])){ |
|
77 | - $this->syntax[]=','.implode(',',$this->data['uniqueValueList']); |
|
76 | + if (isset($this->data['uniqueValueList']) && count($this->data['uniqueValueList'])) { |
|
77 | + $this->syntax[] = ','.implode(',', $this->data['uniqueValueList']); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | //get index values |
81 | - if(isset($this->data['indexValueList']) && count($this->data['indexValueList'])){ |
|
82 | - $this->syntax[]=','.implode(',',$this->data['indexValueList']); |
|
81 | + if (isset($this->data['indexValueList']) && count($this->data['indexValueList'])) { |
|
82 | + $this->syntax[] = ','.implode(',', $this->data['indexValueList']); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | //get index values for key |
86 | - if(count($this->getKeyList())){ |
|
87 | - $this->syntax[]=','.implode(',',$this->getKeyList()); |
|
86 | + if (count($this->getKeyList())) { |
|
87 | + $this->syntax[] = ','.implode(',', $this->getKeyList()); |
|
88 | 88 | } |
89 | 89 | |
90 | - if(count($this->data['references'])){ |
|
91 | - $this->syntax[]=$this->getReferenceSyntax($this->data['references']); |
|
90 | + if (count($this->data['references'])) { |
|
91 | + $this->syntax[] = $this->getReferenceSyntax($this->data['references']); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -112,33 +112,33 @@ discard block |
||
112 | 112 | |
113 | 113 | private function change($alterType) |
114 | 114 | { |
115 | - if(isset($alterType['place'])){ |
|
115 | + if (isset($alterType['place'])) { |
|
116 | 116 | |
117 | - foreach ($alterType['place'] as $placeKey=>$placeValue){ |
|
118 | - $placeList=$placeKey .' '.$placeValue.''; |
|
117 | + foreach ($alterType['place'] as $placeKey=>$placeValue) { |
|
118 | + $placeList = $placeKey.' '.$placeValue.''; |
|
119 | 119 | } |
120 | 120 | |
121 | - $syntax = implode("",$this->syntax); |
|
121 | + $syntax = implode("", $this->syntax); |
|
122 | 122 | |
123 | 123 | $columns = $this->schema->getConnection()->showColumnsFrom($this->table); |
124 | 124 | |
125 | - foreach ($columns as $columnKey=>$columnData){ |
|
126 | - if($columnData['Field']==$placeValue){ |
|
125 | + foreach ($columns as $columnKey=>$columnData) { |
|
126 | + if ($columnData['Field']==$placeValue) { |
|
127 | 127 | $changeAbleField = $columns[$columnKey+1]['Field']; |
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - $syntaxList = explode(' ',$syntax); |
|
131 | + $syntaxList = explode(' ', $syntax); |
|
132 | 132 | |
133 | - if(current($syntaxList)!==$changeAbleField){ |
|
134 | - $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).' '.implode(' ',array_splice($syntaxList,1)).' '.$placeList; |
|
133 | + if (current($syntaxList)!==$changeAbleField) { |
|
134 | + $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).' '.implode(' ', array_splice($syntaxList, 1)).' '.$placeList; |
|
135 | 135 | } |
136 | - else{ |
|
136 | + else { |
|
137 | 137 | $alterSytanx = 'ALTER TABLE '.$this->table.' modify '.$syntax.' '.$placeList; |
138 | 138 | } |
139 | 139 | |
140 | 140 | |
141 | - $query=$this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
141 | + $query = $this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
142 | 142 | |
143 | 143 | return [ |
144 | 144 | 'syntax'=>$syntax, |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | |
152 | 152 | private function addColumn($alterType) |
153 | 153 | { |
154 | - if(isset($alterType['place'])){ |
|
154 | + if (isset($alterType['place'])) { |
|
155 | 155 | |
156 | - foreach ($alterType['place'] as $placeKey=>$placeValue){ |
|
157 | - $placeList=$placeKey .' '.$placeValue.''; |
|
156 | + foreach ($alterType['place'] as $placeKey=>$placeValue) { |
|
157 | + $placeList = $placeKey.' '.$placeValue.''; |
|
158 | 158 | } |
159 | 159 | |
160 | - $syntax = implode("",$this->syntax); |
|
160 | + $syntax = implode("", $this->syntax); |
|
161 | 161 | |
162 | 162 | $alterSytanx = 'ALTER TABLE '.$this->table.' ADD COLUMN '.$syntax.' '.$placeList; |
163 | 163 | |
164 | - $query=$this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
164 | + $query = $this->schema->getConnection()->setQueryBasic($alterSytanx); |
|
165 | 165 | |
166 | 166 | return [ |
167 | 167 | 'syntax'=>$syntax, |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | //get table collation |
33 | 33 | if(isset($this->data['tableCollation']['table'])){ |
34 | 34 | $this->syntax[]=' DEFAULT CHARACTER SET '.$this->data['tableCollation']['table']; |
35 | - } |
|
36 | - else{ |
|
35 | + } else{ |
|
37 | 36 | $this->syntax[]=' DEFAULT CHARACTER SET utf8'; |
38 | 37 | } |
39 | 38 | |
@@ -41,8 +40,7 @@ discard block |
||
41 | 40 | if($this->data['engine']!==null) |
42 | 41 | { |
43 | 42 | $this->syntax[]=' ENGINE='.$this->data['engine'].' '; |
44 | - } |
|
45 | - else{ |
|
43 | + } else{ |
|
46 | 44 | $this->syntax[]=' ENGINE=InnoDB '; |
47 | 45 | } |
48 | 46 | |
@@ -50,8 +48,7 @@ discard block |
||
50 | 48 | |
51 | 49 | if(in_array($this->table,$existTables)){ |
52 | 50 | return false; |
53 | - } |
|
54 | - else{ |
|
51 | + } else{ |
|
55 | 52 | $query=$this->schema->getConnection()->setQueryBasic($syntax); |
56 | 53 | |
57 | 54 | return [ |
@@ -132,8 +129,7 @@ discard block |
||
132 | 129 | |
133 | 130 | if(current($syntaxList)!==$changeAbleField){ |
134 | 131 | $alterSytanx = 'ALTER TABLE '.$this->table.' change '.$changeAbleField.' '.current($syntaxList).' '.implode(' ',array_splice($syntaxList,1)).' '.$placeList; |
135 | - } |
|
136 | - else{ |
|
132 | + } else{ |
|
137 | 133 | $alterSytanx = 'ALTER TABLE '.$this->table.' modify '.$syntax.' '.$placeList; |
138 | 134 | } |
139 | 135 |