@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @var array |
27 | 27 | */ |
28 | - protected $stubList=array(); |
|
28 | + protected $stubList = array(); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * FileProcess constructor. |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | * @param $data |
42 | 42 | * @return bool |
43 | 43 | */ |
44 | - public function dumpFile($file,$data) |
|
44 | + public function dumpFile($file, $data) |
|
45 | 45 | { |
46 | 46 | try { |
47 | - $this->fs->dumpFile($file,$data); |
|
47 | + $this->fs->dumpFile($file, $data); |
|
48 | 48 | return true; |
49 | 49 | } catch (IOExceptionInterface $exception) { |
50 | 50 | return false; |
@@ -56,21 +56,21 @@ discard block |
||
56 | 56 | * @param bool $status |
57 | 57 | * @return mixed |
58 | 58 | */ |
59 | - public function makeDirectory($data,$status=false) |
|
59 | + public function makeDirectory($data, $status = false) |
|
60 | 60 | { |
61 | - if($data->type=="project" && file_exists($data->project)){ |
|
61 | + if ($data->type=="project" && file_exists($data->project)) { |
|
62 | 62 | throw new \LogicException('This Project Is Already Available'); |
63 | 63 | } |
64 | - if(false===$status){ |
|
64 | + if (false===$status) { |
|
65 | 65 | |
66 | - if($data->type!=="project" && !file_exists($data->project)){ |
|
66 | + if ($data->type!=="project" && !file_exists($data->project)) { |
|
67 | 67 | throw new \LogicException('Project No'); |
68 | 68 | } |
69 | 69 | } |
70 | - foreach ($data->directory as $directory){ |
|
70 | + foreach ($data->directory as $directory) { |
|
71 | 71 | try { |
72 | - $this->fs->mkdir($directory,'0777'); |
|
73 | - chmod($directory,0777); |
|
72 | + $this->fs->mkdir($directory, '0777'); |
|
73 | + chmod($directory, 0777); |
|
74 | 74 | } catch (IOExceptionInterface $e) { |
75 | 75 | return "An error occurred while creating your directory at ".$e->getPath(); |
76 | 76 | } |
@@ -102,25 +102,25 @@ discard block |
||
102 | 102 | * @param $data |
103 | 103 | * @param array $complex |
104 | 104 | */ |
105 | - public function touch($data,$complex=array()) |
|
105 | + public function touch($data, $complex = array()) |
|
106 | 106 | { |
107 | - $this->data=$data; |
|
107 | + $this->data = $data; |
|
108 | 108 | |
109 | - if(isset($complex['stub']) && isset($this->data->argument['stub'])){ |
|
109 | + if (isset($complex['stub']) && isset($this->data->argument['stub'])) { |
|
110 | 110 | |
111 | 111 | $this->stubManager($complex); |
112 | 112 | } |
113 | 113 | |
114 | - $execArray=(count($this->stubList)) ? $this->stubList : $this->data->touch; |
|
114 | + $execArray = (count($this->stubList)) ? $this->stubList : $this->data->touch; |
|
115 | 115 | |
116 | - foreach ($execArray as $execution=>$touch){ |
|
116 | + foreach ($execArray as $execution=>$touch) { |
|
117 | 117 | |
118 | - if(!file_exists($touch) && $touch!==null){ |
|
118 | + if (!file_exists($touch) && $touch!==null) { |
|
119 | 119 | touch($touch); |
120 | 120 | |
121 | - $executionPath=$this->stubPath.'/'.$execution.'.stub'; |
|
122 | - if(file_exists($executionPath)){ |
|
123 | - $this->fopenprocess($executionPath,$touch,$data); |
|
121 | + $executionPath = $this->stubPath.'/'.$execution.'.stub'; |
|
122 | + if (file_exists($executionPath)) { |
|
123 | + $this->fopenprocess($executionPath, $touch, $data); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
@@ -129,37 +129,37 @@ discard block |
||
129 | 129 | /** |
130 | 130 | * @param array $complex |
131 | 131 | */ |
132 | - private function stubManager($complex=array()) |
|
132 | + private function stubManager($complex = array()) |
|
133 | 133 | { |
134 | - $stubStructure = explode("_",$complex['stub']); |
|
134 | + $stubStructure = explode("_", $complex['stub']); |
|
135 | 135 | $stubStructure[] = $this->data->argument['stub']; |
136 | 136 | |
137 | - $stubberDirectoryList=path()->stubs(); |
|
137 | + $stubberDirectoryList = path()->stubs(); |
|
138 | 138 | |
139 | - foreach ($stubStructure as $stubberDirectory){ |
|
139 | + foreach ($stubStructure as $stubberDirectory) { |
|
140 | 140 | |
141 | 141 | $stubberDirectoryList = $stubberDirectoryList.'/'.$stubberDirectory; |
142 | 142 | |
143 | 143 | $this->setDirectory($stubberDirectoryList); |
144 | 144 | } |
145 | 145 | |
146 | - foreach ($this->data->touch as $execution=>$executionFile){ |
|
146 | + foreach ($this->data->touch as $execution=>$executionFile) { |
|
147 | 147 | |
148 | - $executionArray=explode("/",$execution); |
|
148 | + $executionArray = explode("/", $execution); |
|
149 | 149 | |
150 | 150 | $executionStub = end($executionArray).''; |
151 | 151 | $this->stubList[$executionStub] = $executionFile; |
152 | 152 | $stubberFile = $stubberDirectoryList.'/'.$executionStub.'.stub'; |
153 | 153 | |
154 | - $originalPath=$this->stubPath.'/'.$execution.'.stub'; |
|
154 | + $originalPath = $this->stubPath.'/'.$execution.'.stub'; |
|
155 | 155 | |
156 | - if(!file_exists($stubberFile)){ |
|
156 | + if (!file_exists($stubberFile)) { |
|
157 | 157 | |
158 | - $this->fs->copy($originalPath,$stubberFile); |
|
158 | + $this->fs->copy($originalPath, $stubberFile); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - $this->stubPath=$stubberDirectoryList; |
|
162 | + $this->stubPath = $stubberDirectoryList; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | * @param $param |
170 | 170 | * @return bool |
171 | 171 | */ |
172 | - public function fopenprocess($executionPath,$path,$param) |
|
172 | + public function fopenprocess($executionPath, $path, $param) |
|
173 | 173 | { |
174 | 174 | $dt = fopen($executionPath, "r"); |
175 | 175 | $content = fread($dt, filesize($executionPath)); |
176 | 176 | fclose($dt); |
177 | 177 | |
178 | - foreach ($param->argument as $key=>$value){ |
|
178 | + foreach ($param->argument as $key=>$value) { |
|
179 | 179 | |
180 | - $content=str_replace("__".$key."__",$value,$content); |
|
180 | + $content = str_replace("__".$key."__", $value, $content); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | $dt = fopen($path, "w"); |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | * @param $param |
194 | 194 | * @return bool |
195 | 195 | */ |
196 | - public function stubCopy($executionPath,$path,$param) |
|
196 | + public function stubCopy($executionPath, $path, $param) |
|
197 | 197 | { |
198 | 198 | $dt = fopen($executionPath, "r"); |
199 | 199 | $content = fread($dt, filesize($executionPath)); |
200 | 200 | fclose($dt); |
201 | 201 | |
202 | - foreach ($param->argument as $key=>$value){ |
|
203 | - $content=str_replace("__".$key."__",$value,$content); |
|
202 | + foreach ($param->argument as $key=>$value) { |
|
203 | + $content = str_replace("__".$key."__", $value, $content); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | $dt = fopen($path, "w"); |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | * @param null $file |
215 | 215 | * @return mixed|null |
216 | 216 | */ |
217 | - public function callFile($file=null) |
|
217 | + public function callFile($file = null) |
|
218 | 218 | { |
219 | - if(file_exists($file)){ |
|
219 | + if (file_exists($file)) { |
|
220 | 220 | return require_once($file); |
221 | 221 | } |
222 | 222 | return null; |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | * @param null|string $file |
229 | 229 | * @param null|string $data |
230 | 230 | */ |
231 | - public function writeFile($file=null,$data=null) |
|
231 | + public function writeFile($file = null, $data = null) |
|
232 | 232 | { |
233 | - if(!is_null($file) && !is_null($data)){ |
|
233 | + if (!is_null($file) && !is_null($data)) { |
|
234 | 234 | |
235 | 235 | $dt = fopen($file, "r"); |
236 | 236 | $content = fread($dt, filesize($file)); |