@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | private function getPaths($params) |
48 | 48 | { |
49 | - if(!isset($params[3])){ |
|
49 | + if (!isset($params[3])) { |
|
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,28 +86,28 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function get($params) |
88 | 88 | { |
89 | - list($table,$name,$type) = $params; |
|
89 | + list($table, $name, $type) = $params; |
|
90 | 90 | |
91 | 91 | $results = []; |
92 | 92 | |
93 | 93 | $paths = $this->getPaths($params); |
94 | 94 | |
95 | - foreach ($paths as $pathKey=>$path){ |
|
95 | + foreach ($paths as $pathKey=>$path) { |
|
96 | 96 | |
97 | 97 | $tableDirectory = $path.'/'.ucfirst($table); |
98 | 98 | |
99 | 99 | |
100 | - if(!file_exists($tableDirectory)){ |
|
101 | - $results['directory'][$pathKey]= $this->fileProcess($tableDirectory,'makeDirectory'); |
|
100 | + if (!file_exists($tableDirectory)) { |
|
101 | + $results['directory'][$pathKey] = $this->fileProcess($tableDirectory, 'makeDirectory'); |
|
102 | 102 | } |
103 | - else{ |
|
104 | - $results['directory'][$pathKey]= $this->getResult(false, |
|
103 | + else { |
|
104 | + $results['directory'][$pathKey] = $this->getResult(false, |
|
105 | 105 | 'Already exist the specified directory'); |
106 | 106 | } |
107 | 107 | |
108 | - $results['directory'][$pathKey]['table']= $table; |
|
109 | - $results['directory'][$pathKey]['directory']= $table; |
|
110 | - $results['directory'][$pathKey]['type']= $type; |
|
108 | + $results['directory'][$pathKey]['table'] = $table; |
|
109 | + $results['directory'][$pathKey]['directory'] = $table; |
|
110 | + $results['directory'][$pathKey]['type'] = $type; |
|
111 | 111 | |
112 | 112 | $fileName = ucfirst($name); |
113 | 113 | |
@@ -115,23 +115,23 @@ discard block |
||
115 | 115 | |
116 | 116 | $filePath = $tableDirectory.'/'.$fileNameWithTime.'.php'; |
117 | 117 | |
118 | - if(!file_exists($filePath)){ |
|
119 | - $results['file'][$pathKey]=$this->fileProcess($filePath,'makeFile'); |
|
118 | + if (!file_exists($filePath)) { |
|
119 | + $results['file'][$pathKey] = $this->fileProcess($filePath, 'makeFile'); |
|
120 | 120 | } |
121 | - else{ |
|
122 | - $results['file'][$pathKey]= $this->getResult(false, |
|
121 | + else { |
|
122 | + $results['file'][$pathKey] = $this->getResult(false, |
|
123 | 123 | 'Already exist the specified file'); |
124 | 124 | } |
125 | 125 | |
126 | - $results['file'][$pathKey]['table']=$table; |
|
127 | - $results['file'][$pathKey]['file']=$fileName; |
|
128 | - $results['file'][$pathKey]['type']=$type; |
|
126 | + $results['file'][$pathKey]['table'] = $table; |
|
127 | + $results['file'][$pathKey]['file'] = $fileName; |
|
128 | + $results['file'][$pathKey]['type'] = $type; |
|
129 | 129 | |
130 | 130 | $stubber = $this->stubber.'/'.$type.'.stub'; |
131 | 131 | |
132 | - $this->fopenprocess($stubber,$filePath,['className'=>$fileName]); |
|
132 | + $this->fopenprocess($stubber, $filePath, ['className'=>$fileName]); |
|
133 | 133 | |
134 | - $this->file->chmod($tableDirectory,0777,000,true); |
|
134 | + $this->file->chmod($tableDirectory, 0777, 000, true); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $results; |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | * @param $process |
143 | 143 | * @return array |
144 | 144 | */ |
145 | - private function fileProcess($path,$process) |
|
145 | + private function fileProcess($path, $process) |
|
146 | 146 | { |
147 | 147 | try { |
148 | 148 | $this->{$process}($path); |
149 | - return $this->getResult(true,null); |
|
149 | + return $this->getResult(true, null); |
|
150 | 150 | } catch (IOExceptionInterface $exception) { |
151 | 151 | return $this->getResult(false, |
152 | 152 | "An error occurred while creating your directory at ".$exception->getPath().""); |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | * @param $path |
158 | 158 | * @param int $mode |
159 | 159 | */ |
160 | - private function makeDirectory($path,$mode=0777) |
|
160 | + private function makeDirectory($path, $mode = 0777) |
|
161 | 161 | { |
162 | - return $this->file->mkdir($path,$mode); |
|
162 | + return $this->file->mkdir($path, $mode); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @param $message |
176 | 176 | * @return array |
177 | 177 | */ |
178 | - private function getResult($success,$message) |
|
178 | + private function getResult($success, $message) |
|
179 | 179 | { |
180 | 180 | return [ |
181 | 181 | 'success'=>$success, |