@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | private function getPaths($params) |
| 48 | 48 | { |
| 49 | - if(!isset($params[0]['group'])){ |
|
| 49 | + if (!isset($params[0]['group'])) { |
|
| 50 | 50 | return [$this->config['paths'][0]]; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | * @param $params |
| 60 | 60 | * @return bool |
| 61 | 61 | */ |
| 62 | - private function fopenprocess($executionPath,$path,$params) |
|
| 62 | + private function fopenprocess($executionPath, $path, $params) |
|
| 63 | 63 | { |
| 64 | 64 | $dt = fopen($executionPath, "r"); |
| 65 | 65 | $content = fread($dt, filesize($executionPath)); |
| 66 | 66 | fclose($dt); |
| 67 | 67 | |
| 68 | - foreach ($params as $key=>$value){ |
|
| 68 | + foreach ($params as $key=>$value) { |
|
| 69 | 69 | |
| 70 | - $content=str_replace("__".$key."__",$value,$content); |
|
| 70 | + $content = str_replace("__".$key."__", $value, $content); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function get($params) |
| 88 | 88 | { |
| 89 | - list($arguments,$type) = $params; |
|
| 89 | + list($arguments, $type) = $params; |
|
| 90 | 90 | |
| 91 | 91 | $table = $arguments['table']; |
| 92 | 92 | $name = $arguments['name']; |
@@ -95,22 +95,22 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $paths = $this->getPaths($params); |
| 97 | 97 | |
| 98 | - foreach ($paths as $pathKey=>$path){ |
|
| 98 | + foreach ($paths as $pathKey=>$path) { |
|
| 99 | 99 | |
| 100 | 100 | $tableDirectory = $path.'/'.ucfirst($table); |
| 101 | 101 | |
| 102 | 102 | |
| 103 | - if(!file_exists($tableDirectory)){ |
|
| 104 | - $results['directory'][$pathKey]= $this->fileProcess($tableDirectory,'makeDirectory'); |
|
| 103 | + if (!file_exists($tableDirectory)) { |
|
| 104 | + $results['directory'][$pathKey] = $this->fileProcess($tableDirectory, 'makeDirectory'); |
|
| 105 | 105 | } |
| 106 | - else{ |
|
| 107 | - $results['directory'][$pathKey]= $this->getResult(false, |
|
| 106 | + else { |
|
| 107 | + $results['directory'][$pathKey] = $this->getResult(false, |
|
| 108 | 108 | 'Already exist the specified directory'); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - $results['directory'][$pathKey]['table']= $table; |
|
| 112 | - $results['directory'][$pathKey]['directory']= $table; |
|
| 113 | - $results['directory'][$pathKey]['type']= $type; |
|
| 111 | + $results['directory'][$pathKey]['table'] = $table; |
|
| 112 | + $results['directory'][$pathKey]['directory'] = $table; |
|
| 113 | + $results['directory'][$pathKey]['type'] = $type; |
|
| 114 | 114 | |
| 115 | 115 | $fileName = ucfirst($name); |
| 116 | 116 | |
@@ -118,23 +118,23 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $filePath = $tableDirectory.'/'.$fileNameWithTime.'.php'; |
| 120 | 120 | |
| 121 | - if(!file_exists($filePath)){ |
|
| 122 | - $results['file'][$pathKey]=$this->fileProcess($filePath,'makeFile'); |
|
| 121 | + if (!file_exists($filePath)) { |
|
| 122 | + $results['file'][$pathKey] = $this->fileProcess($filePath, 'makeFile'); |
|
| 123 | 123 | } |
| 124 | - else{ |
|
| 125 | - $results['file'][$pathKey]= $this->getResult(false, |
|
| 124 | + else { |
|
| 125 | + $results['file'][$pathKey] = $this->getResult(false, |
|
| 126 | 126 | 'Already exist the specified file'); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $results['file'][$pathKey]['table']=$table; |
|
| 130 | - $results['file'][$pathKey]['file']=$fileName; |
|
| 131 | - $results['file'][$pathKey]['type']=$type; |
|
| 129 | + $results['file'][$pathKey]['table'] = $table; |
|
| 130 | + $results['file'][$pathKey]['file'] = $fileName; |
|
| 131 | + $results['file'][$pathKey]['type'] = $type; |
|
| 132 | 132 | |
| 133 | 133 | $stubber = $this->stubber.'/'.$type.'.stub'; |
| 134 | 134 | |
| 135 | - $this->fopenprocess($stubber,$filePath,['className'=>$fileName]); |
|
| 135 | + $this->fopenprocess($stubber, $filePath, ['className'=>$fileName]); |
|
| 136 | 136 | |
| 137 | - $this->file->chmod($tableDirectory,0777,000,true); |
|
| 137 | + $this->file->chmod($tableDirectory, 0777, 000, true); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | return $results; |
@@ -145,11 +145,11 @@ discard block |
||
| 145 | 145 | * @param $process |
| 146 | 146 | * @return array |
| 147 | 147 | */ |
| 148 | - private function fileProcess($path,$process) |
|
| 148 | + private function fileProcess($path, $process) |
|
| 149 | 149 | { |
| 150 | 150 | try { |
| 151 | 151 | $this->{$process}($path); |
| 152 | - return $this->getResult(true,null); |
|
| 152 | + return $this->getResult(true, null); |
|
| 153 | 153 | } catch (IOExceptionInterface $exception) { |
| 154 | 154 | return $this->getResult(false, |
| 155 | 155 | "An error occurred while creating your directory at ".$exception->getPath().""); |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | * @param $path |
| 161 | 161 | * @param int $mode |
| 162 | 162 | */ |
| 163 | - private function makeDirectory($path,$mode=0777) |
|
| 163 | + private function makeDirectory($path, $mode = 0777) |
|
| 164 | 164 | { |
| 165 | - return $this->file->mkdir($path,$mode); |
|
| 165 | + return $this->file->mkdir($path, $mode); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param $message |
| 179 | 179 | * @return array |
| 180 | 180 | */ |
| 181 | - private function getResult($success,$message) |
|
| 181 | + private function getResult($success, $message) |
|
| 182 | 182 | { |
| 183 | 183 | return [ |
| 184 | 184 | 'success'=>$success, |