@@ -133,8 +133,9 @@ discard block |
||
133 | 133 | { |
134 | 134 | $config = $module->getConfig(); |
135 | 135 | |
136 | - if (!array_key_exists($view, $config["view_manager"]["view_map"]) || !file_exists($config["view_manager"]["view_map"][$view])) |
|
137 | - throw new Exception\ViewNotFoundException("The 'view' template " . $view . " does not exists"); |
|
136 | + if (!array_key_exists($view, $config["view_manager"]["view_map"]) || !file_exists($config["view_manager"]["view_map"][$view])) { |
|
137 | + throw new Exception\ViewNotFoundException("The 'view' template " . $view . " does not exists"); |
|
138 | + } |
|
138 | 139 | |
139 | 140 | $this->view = $config["view_manager"]["view_map"][$view]; |
140 | 141 | } |
@@ -164,8 +165,9 @@ discard block |
||
164 | 165 | { |
165 | 166 | foreach ($params as $param => $value) |
166 | 167 | { |
167 | - if (property_exists(__CLASS__, strtolower($param)) && method_exists($this, 'set'.$param)) |
|
168 | - $this->{'set'.$param}($value); |
|
168 | + if (property_exists(__CLASS__, strtolower($param)) && method_exists($this, 'set'.$param)) { |
|
169 | + $this->{'set'.$param}($value); |
|
170 | + } |
|
169 | 171 | } |
170 | 172 | } |
171 | 173 | |
@@ -194,23 +196,26 @@ discard block |
||
194 | 196 | |
195 | 197 | if ($controller->getTerminal()) |
196 | 198 | { |
197 | - if (file_exists($view)) |
|
198 | - include $view; |
|
199 | - } |
|
200 | - else |
|
199 | + if (file_exists($view)) { |
|
200 | + include $view; |
|
201 | + } |
|
202 | + } else |
|
201 | 203 | { |
202 | - if (!is_null($this->view) && !file_exists($this->view)) |
|
203 | - throw new Exception\ViewNotFoundException("The 'view' template " . $this->view . " does not exists"); |
|
204 | + if (!is_null($this->view) && !file_exists($this->view)) { |
|
205 | + throw new Exception\ViewNotFoundException("The 'view' template " . $this->view . " does not exists"); |
|
206 | + } |
|
204 | 207 | |
205 | 208 | $config = $controller->getModule()->getConfig(); |
206 | 209 | |
207 | - if (!array_key_exists($controller->getLayout(), $config["view_manager"]["template_map"])) |
|
208 | - throw new Exception\PageNotFoundException("The 'template' " . $template . " was not defined in module.config.php"); |
|
210 | + if (!array_key_exists($controller->getLayout(), $config["view_manager"]["template_map"])) { |
|
211 | + throw new Exception\PageNotFoundException("The 'template' " . $template . " was not defined in module.config.php"); |
|
212 | + } |
|
209 | 213 | |
210 | 214 | $template = $config["view_manager"]["template_map"][$controller->getLayout()]; |
211 | 215 | |
212 | - if (!file_exists($template)) |
|
213 | - throw new Exception\PageNotFoundException("The 'template' " . $template . " does not exists"); |
|
216 | + if (!file_exists($template)) { |
|
217 | + throw new Exception\PageNotFoundException("The 'template' " . $template . " does not exists"); |
|
218 | + } |
|
214 | 219 | |
215 | 220 | include $template; |
216 | 221 | } |
@@ -237,8 +242,9 @@ discard block |
||
237 | 242 | */ |
238 | 243 | public function content() |
239 | 244 | { |
240 | - if (!file_exists($this->view)) |
|
241 | - throw new Exception\ViewNotFoundException("The 'view' template " . $this->view . " does not exists"); |
|
245 | + if (!file_exists($this->view)) { |
|
246 | + throw new Exception\ViewNotFoundException("The 'view' template " . $this->view . " does not exists"); |
|
247 | + } |
|
242 | 248 | |
243 | 249 | include $this->view; |
244 | 250 | } |
@@ -150,8 +150,9 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function getPost() |
152 | 152 | { |
153 | - if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST)) |
|
154 | - $_POST = json_decode(file_get_contents('php://input'), true); |
|
153 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST)) { |
|
154 | + $_POST = json_decode(file_get_contents('php://input'), true); |
|
155 | + } |
|
155 | 156 | |
156 | 157 | return (array) $_POST; |
157 | 158 | } |
@@ -165,8 +166,9 @@ discard block |
||
165 | 166 | */ |
166 | 167 | public function getJson() |
167 | 168 | { |
168 | - if ($_SERVER['REQUEST_METHOD'] != 'JSON') |
|
169 | - throw new \LogicException("Request method is not JSON"); |
|
169 | + if ($_SERVER['REQUEST_METHOD'] != 'JSON') { |
|
170 | + throw new \LogicException("Request method is not JSON"); |
|
171 | + } |
|
170 | 172 | |
171 | 173 | $input = file_get_contents('php://input'); |
172 | 174 | $array = explode("&", $input); |
@@ -254,8 +256,9 @@ discard block |
||
254 | 256 | $this->module = new $fqn($module, $this); |
255 | 257 | |
256 | 258 | # detects method change inside Module.php |
257 | - if (!is_null($this->getMethod())) |
|
258 | - $method = $this->getMethod(); |
|
259 | + if (!is_null($this->getMethod())) { |
|
260 | + $method = $this->getMethod(); |
|
261 | + } |
|
259 | 262 | |
260 | 263 | if (!is_null($method) && $this->initExecution) |
261 | 264 | { |
@@ -265,8 +268,9 @@ discard block |
||
265 | 268 | |
266 | 269 | $reflection = new \ReflectionMethod($this, $method); |
267 | 270 | |
268 | - if (!$reflection->isPublic()) |
|
269 | - throw new Exception\PageNotFoundException("The method '$method' is not public in the control class '$class'"); |
|
271 | + if (!$reflection->isPublic()) { |
|
272 | + throw new Exception\PageNotFoundException("The method '$method' is not public in the control class '$class'"); |
|
273 | + } |
|
270 | 274 | |
271 | 275 | $this->method = $method; |
272 | 276 | |
@@ -282,8 +286,7 @@ discard block |
||
282 | 286 | $layoutManager = new Layout($layout_params); |
283 | 287 | $layoutManager->fromController($this); |
284 | 288 | } |
285 | - } |
|
286 | - else { |
|
289 | + } else { |
|
287 | 290 | $class = __CLASS__; |
288 | 291 | throw new Exception\PageNotFoundException("The method '$method' doesn't exists in the control class '$class'"); |
289 | 292 | } |
@@ -308,8 +311,9 @@ discard block |
||
308 | 311 | public function isXmlHttpRequest() |
309 | 312 | { |
310 | 313 | # non standard (HTTP_X_REQUESTED_WITH is not a part of PHP) |
311 | - if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) |
|
312 | - return true; |
|
314 | + if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { |
|
315 | + return true; |
|
316 | + } |
|
313 | 317 | return false; |
314 | 318 | } |
315 | 319 | |
@@ -320,8 +324,9 @@ discard block |
||
320 | 324 | */ |
321 | 325 | public function isPost() |
322 | 326 | { |
323 | - if ($_SERVER["REQUEST_METHOD"] == "POST") |
|
324 | - return true; |
|
327 | + if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|
328 | + return true; |
|
329 | + } |
|
325 | 330 | return false; |
326 | 331 | } |
327 | 332 | |
@@ -332,8 +337,9 @@ discard block |
||
332 | 337 | */ |
333 | 338 | public function isGet() |
334 | 339 | { |
335 | - if ($_SERVER["REQUEST_METHOD"] == "GET") |
|
336 | - return true; |
|
340 | + if ($_SERVER["REQUEST_METHOD"] == "GET") { |
|
341 | + return true; |
|
342 | + } |
|
337 | 343 | return false; |
338 | 344 | } |
339 | 345 | |
@@ -357,10 +363,11 @@ discard block |
||
357 | 363 | $i = 1; |
358 | 364 | foreach ($params as $item) |
359 | 365 | { |
360 | - if ($i % 2 != 0) |
|
361 | - $vars[] = $item; |
|
362 | - else |
|
363 | - $values[] = $item; |
|
366 | + if ($i % 2 != 0) { |
|
367 | + $vars[] = $item; |
|
368 | + } else { |
|
369 | + $values[] = $item; |
|
370 | + } |
|
364 | 371 | $i++; |
365 | 372 | } |
366 | 373 | |
@@ -368,10 +375,11 @@ discard block |
||
368 | 375 | |
369 | 376 | for ($i = 0; $i < $vars_count; $i++) |
370 | 377 | { |
371 | - if (array_key_exists($i, $values)) |
|
372 | - $_GET[$vars[$i]] = $values[$i]; |
|
373 | - else |
|
374 | - $_GET[$vars[$i]] = ''; |
|
378 | + if (array_key_exists($i, $values)) { |
|
379 | + $_GET[$vars[$i]] = $values[$i]; |
|
380 | + } else { |
|
381 | + $_GET[$vars[$i]] = ''; |
|
382 | + } |
|
375 | 383 | } |
376 | 384 | |
377 | 385 | unset($_GET["params"]); |
@@ -93,24 +93,24 @@ discard block |
||
93 | 93 | { |
94 | 94 | foreach ($contents as $i) |
95 | 95 | { |
96 | - if (is_file($handler.'/'.$i)) |
|
96 | + if (is_file($handler . '/' . $i)) |
|
97 | 97 | { |
98 | - $allContents[] = $handler.'/'.$i; |
|
98 | + $allContents[] = $handler . '/' . $i; |
|
99 | 99 | |
100 | - $this->buffer = $handler.'/'.$i; |
|
100 | + $this->buffer = $handler . '/' . $i; |
|
101 | 101 | call_user_func($fileCallback, $this); |
102 | 102 | } |
103 | - elseif (is_dir($handler.'/'.$i)) |
|
103 | + elseif (is_dir($handler . '/' . $i)) |
|
104 | 104 | { |
105 | - $allContents[] = $handler.'/'.$i; |
|
105 | + $allContents[] = $handler . '/' . $i; |
|
106 | 106 | |
107 | - $this->buffer = $handler.'/'.$i; |
|
108 | - $this->getContents($handler.'/'.$i, $fileCallback, $dirCallback); |
|
107 | + $this->buffer = $handler . '/' . $i; |
|
108 | + $this->getContents($handler . '/' . $i, $fileCallback, $dirCallback); |
|
109 | 109 | |
110 | 110 | $directory = scandir($handler); |
111 | 111 | |
112 | 112 | if (!count($directory) < 3) |
113 | - $this->buffer = $handler.'/'.$i; |
|
113 | + $this->buffer = $handler . '/' . $i; |
|
114 | 114 | |
115 | 115 | call_user_func($dirCallback, $this); |
116 | 116 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if (!empty($path)) |
197 | 197 | if (!strlen(stristr($item, $path)) > 0) |
198 | 198 | continue; |
199 | - if (strstr($item,'~') === false && $item != '.' && $item != '..') |
|
199 | + if (strstr($item, '~') === false && $item != '.' && $item != '..') |
|
200 | 200 | $filesToReturn[] = $item; |
201 | 201 | } |
202 | 202 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | if (is_dir($dest)) |
300 | 300 | { |
301 | 301 | if (!$recursive) |
302 | - copy($file, $dest.'/'.$file); |
|
302 | + copy($file, $dest . '/' . $file); |
|
303 | 303 | else { |
304 | 304 | |
305 | 305 | $files = array(); |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | |
319 | 319 | foreach ($files[1] as $item) |
320 | 320 | { |
321 | - if (!file_exists($dest.'/'.$item)) |
|
321 | + if (!file_exists($dest . '/' . $item)) |
|
322 | 322 | mkdir("$dest/$item", 0777, true); |
323 | 323 | } |
324 | 324 | |
325 | 325 | foreach ($files[0] as $item) |
326 | 326 | { |
327 | 327 | if (!file_exists("$dest/$files")) |
328 | - copy($item, $dest.'/'.$item); |
|
328 | + copy($item, $dest . '/' . $item); |
|
329 | 329 | } |
330 | 330 | }); |
331 | 331 | } |
@@ -350,12 +350,12 @@ discard block |
||
350 | 350 | throw new Exception("Missing parameter for mv!"); |
351 | 351 | |
352 | 352 | if (is_dir($newfile)) |
353 | - $newfile .= '/'.basename($oldfile); |
|
353 | + $newfile .= '/' . basename($oldfile); |
|
354 | 354 | |
355 | 355 | if ($oldfile == $newfile) |
356 | 356 | throw new Exception("'$oldfile' and '$newfile' are the same file"); |
357 | 357 | |
358 | - if(!rename($oldfile, $newfile)) |
|
358 | + if (!rename($oldfile, $newfile)) |
|
359 | 359 | return false; |
360 | 360 | |
361 | 361 | return true; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | else { |
386 | 386 | if (!is_dir($dir)) |
387 | 387 | { |
388 | - if(!mkdir("$dir", 0777)) |
|
388 | + if (!mkdir("$dir", 0777)) |
|
389 | 389 | return false; |
390 | 390 | } |
391 | 391 | } |
@@ -83,8 +83,9 @@ discard block |
||
83 | 83 | |
84 | 84 | foreach ($filesForHandler as $item) |
85 | 85 | { |
86 | - if ($item != '.' && $item != '..') |
|
87 | - $contents[] = $item; |
|
86 | + if ($item != '.' && $item != '..') { |
|
87 | + $contents[] = $item; |
|
88 | + } |
|
88 | 89 | } |
89 | 90 | |
90 | 91 | $allContents = $contents; |
@@ -99,8 +100,7 @@ discard block |
||
99 | 100 | |
100 | 101 | $this->buffer = $handler.'/'.$i; |
101 | 102 | call_user_func($fileCallback, $this); |
102 | - } |
|
103 | - elseif (is_dir($handler.'/'.$i)) |
|
103 | + } elseif (is_dir($handler.'/'.$i)) |
|
104 | 104 | { |
105 | 105 | $allContents[] = $handler.'/'.$i; |
106 | 106 | |
@@ -109,19 +109,21 @@ discard block |
||
109 | 109 | |
110 | 110 | $directory = scandir($handler); |
111 | 111 | |
112 | - if (!count($directory) < 3) |
|
113 | - $this->buffer = $handler.'/'.$i; |
|
112 | + if (!count($directory) < 3) { |
|
113 | + $this->buffer = $handler.'/'.$i; |
|
114 | + } |
|
114 | 115 | |
115 | 116 | call_user_func($dirCallback, $this); |
116 | 117 | } |
117 | 118 | } |
118 | 119 | } |
120 | + } else { |
|
121 | + throw new Exception("The directory '$handler' does not exists"); |
|
119 | 122 | } |
120 | - else |
|
121 | - throw new Exception("The directory '$handler' does not exists"); |
|
122 | 123 | |
123 | - if (!is_null($callback)) |
|
124 | - call_user_func($callback, $this); |
|
124 | + if (!is_null($callback)) { |
|
125 | + call_user_func($callback, $this); |
|
126 | + } |
|
125 | 127 | |
126 | 128 | return $allContents; |
127 | 129 | } |
@@ -133,10 +135,11 @@ discard block |
||
133 | 135 | */ |
134 | 136 | public function pwd() |
135 | 137 | { |
136 | - if (getcwd()) |
|
137 | - $this->buffer = getcwd(); |
|
138 | - else |
|
139 | - return false; |
|
138 | + if (getcwd()) { |
|
139 | + $this->buffer = getcwd(); |
|
140 | + } else { |
|
141 | + return false; |
|
142 | + } |
|
140 | 143 | |
141 | 144 | return $this->buffer; |
142 | 145 | } |
@@ -155,9 +158,9 @@ discard block |
||
155 | 158 | |
156 | 159 | $path = (is_null($path) || empty($path)) ? '.' : $path; |
157 | 160 | |
158 | - if (is_file($path)) |
|
159 | - $filesToReturn = array($path); |
|
160 | - elseif (is_dir($path)) |
|
161 | + if (is_file($path)) { |
|
162 | + $filesToReturn = array($path); |
|
163 | + } elseif (is_dir($path)) |
|
161 | 164 | { |
162 | 165 | $pathIns = dir($path); |
163 | 166 | |
@@ -179,25 +182,25 @@ discard block |
||
179 | 182 | foreach ($files as $item) { |
180 | 183 | $filesToReturn[] = $item; |
181 | 184 | } |
182 | - } |
|
183 | - else { |
|
185 | + } else { |
|
184 | 186 | while (false !== ($item = $pathIns->read())) { |
185 | 187 | $filesToReturn[] = $item; |
186 | 188 | } |
187 | 189 | $pathIns->close(); |
188 | 190 | } |
189 | - } |
|
190 | - else { |
|
191 | + } else { |
|
191 | 192 | |
192 | 193 | $contents = $this->ls(); |
193 | 194 | |
194 | 195 | foreach ($contents as $item) |
195 | 196 | { |
196 | - if (!empty($path)) |
|
197 | - if (!strlen(stristr($item, $path)) > 0) |
|
197 | + if (!empty($path)) { |
|
198 | + if (!strlen(stristr($item, $path)) > 0) |
|
198 | 199 | continue; |
199 | - if (strstr($item,'~') === false && $item != '.' && $item != '..') |
|
200 | - $filesToReturn[] = $item; |
|
200 | + } |
|
201 | + if (strstr($item,'~') === false && $item != '.' && $item != '..') { |
|
202 | + $filesToReturn[] = $item; |
|
203 | + } |
|
201 | 204 | } |
202 | 205 | } |
203 | 206 | |
@@ -217,8 +220,9 @@ discard block |
||
217 | 220 | |
218 | 221 | if (is_dir($path)) |
219 | 222 | { |
220 | - if (chdir($moveTo)) |
|
221 | - return true; |
|
223 | + if (chdir($moveTo)) { |
|
224 | + return true; |
|
225 | + } |
|
222 | 226 | } |
223 | 227 | |
224 | 228 | return false; |
@@ -235,11 +239,13 @@ discard block |
||
235 | 239 | { |
236 | 240 | if (file_exists($file)) |
237 | 241 | { |
238 | - if (!$openFile = fopen($file, 'w+')) |
|
239 | - return false; |
|
242 | + if (!$openFile = fopen($file, 'w+')) { |
|
243 | + return false; |
|
244 | + } |
|
240 | 245 | |
241 | - if (fwrite($openFile, "")) |
|
242 | - return true; |
|
246 | + if (fwrite($openFile, "")) { |
|
247 | + return true; |
|
248 | + } |
|
243 | 249 | |
244 | 250 | fclose($openFile); |
245 | 251 | } |
@@ -259,12 +265,13 @@ discard block |
||
259 | 265 | { |
260 | 266 | $recursive = is_null($recursive) ? false : $recursive; |
261 | 267 | |
262 | - if (is_null($file)) |
|
263 | - throw new Exception("Missing parameter for rm!"); |
|
268 | + if (is_null($file)) { |
|
269 | + throw new Exception("Missing parameter for rm!"); |
|
270 | + } |
|
264 | 271 | |
265 | - if (file_exists($file) && !$recursive) |
|
266 | - unlink($file); |
|
267 | - elseif (is_dir($file) && $recursive) |
|
272 | + if (file_exists($file) && !$recursive) { |
|
273 | + unlink($file); |
|
274 | + } elseif (is_dir($file) && $recursive) |
|
268 | 275 | { |
269 | 276 | $that = $this; |
270 | 277 | |
@@ -293,14 +300,15 @@ discard block |
||
293 | 300 | { |
294 | 301 | $recursive = (is_null($recursive)) ? false : $recursive; |
295 | 302 | |
296 | - if (empty($file) || empty($dest)) |
|
297 | - throw new Exception("Missing parameters!"); |
|
303 | + if (empty($file) || empty($dest)) { |
|
304 | + throw new Exception("Missing parameters!"); |
|
305 | + } |
|
298 | 306 | |
299 | 307 | if (is_dir($dest)) |
300 | 308 | { |
301 | - if (!$recursive) |
|
302 | - copy($file, $dest.'/'.$file); |
|
303 | - else { |
|
309 | + if (!$recursive) { |
|
310 | + copy($file, $dest.'/'.$file); |
|
311 | + } else { |
|
304 | 312 | |
305 | 313 | $files = array(); |
306 | 314 | $files[0] = array(); |
@@ -318,20 +326,22 @@ discard block |
||
318 | 326 | |
319 | 327 | foreach ($files[1] as $item) |
320 | 328 | { |
321 | - if (!file_exists($dest.'/'.$item)) |
|
322 | - mkdir("$dest/$item", 0777, true); |
|
329 | + if (!file_exists($dest.'/'.$item)) { |
|
330 | + mkdir("$dest/$item", 0777, true); |
|
331 | + } |
|
323 | 332 | } |
324 | 333 | |
325 | 334 | foreach ($files[0] as $item) |
326 | 335 | { |
327 | - if (!file_exists("$dest/$files")) |
|
328 | - copy($item, $dest.'/'.$item); |
|
336 | + if (!file_exists("$dest/$files")) { |
|
337 | + copy($item, $dest.'/'.$item); |
|
338 | + } |
|
329 | 339 | } |
330 | 340 | }); |
331 | 341 | } |
342 | + } else { |
|
343 | + copy($file, $dest); |
|
332 | 344 | } |
333 | - else |
|
334 | - copy($file, $dest); |
|
335 | 345 | |
336 | 346 | return true; |
337 | 347 | } |
@@ -346,17 +356,21 @@ discard block |
||
346 | 356 | */ |
347 | 357 | public function mv($oldfile, $newfile) |
348 | 358 | { |
349 | - if (empty($oldfile)) |
|
350 | - throw new Exception("Missing parameter for mv!"); |
|
359 | + if (empty($oldfile)) { |
|
360 | + throw new Exception("Missing parameter for mv!"); |
|
361 | + } |
|
351 | 362 | |
352 | - if (is_dir($newfile)) |
|
353 | - $newfile .= '/'.basename($oldfile); |
|
363 | + if (is_dir($newfile)) { |
|
364 | + $newfile .= '/'.basename($oldfile); |
|
365 | + } |
|
354 | 366 | |
355 | - if ($oldfile == $newfile) |
|
356 | - throw new Exception("'$oldfile' and '$newfile' are the same file"); |
|
367 | + if ($oldfile == $newfile) { |
|
368 | + throw new Exception("'$oldfile' and '$newfile' are the same file"); |
|
369 | + } |
|
357 | 370 | |
358 | - if(!rename($oldfile, $newfile)) |
|
359 | - return false; |
|
371 | + if(!rename($oldfile, $newfile)) { |
|
372 | + return false; |
|
373 | + } |
|
360 | 374 | |
361 | 375 | return true; |
362 | 376 | } |
@@ -372,21 +386,24 @@ discard block |
||
372 | 386 | */ |
373 | 387 | public function mkdir($dir, $dest = null, $recursive = null) |
374 | 388 | { |
375 | - if (empty($dir)) |
|
376 | - throw new Exception("Missing parameter for mkdir!"); |
|
389 | + if (empty($dir)) { |
|
390 | + throw new Exception("Missing parameter for mkdir!"); |
|
391 | + } |
|
377 | 392 | |
378 | - if (empty($dest)) |
|
379 | - $dest = '.'; |
|
393 | + if (empty($dest)) { |
|
394 | + $dest = '.'; |
|
395 | + } |
|
380 | 396 | |
381 | 397 | $recursive = (is_null($recursive)) ? false : $recursive; |
382 | 398 | |
383 | - if ($recursive) |
|
384 | - mkdir("$dest/$dir", 0777, true); |
|
385 | - else { |
|
399 | + if ($recursive) { |
|
400 | + mkdir("$dest/$dir", 0777, true); |
|
401 | + } else { |
|
386 | 402 | if (!is_dir($dir)) |
387 | 403 | { |
388 | - if(!mkdir("$dir", 0777)) |
|
389 | - return false; |
|
404 | + if(!mkdir("$dir", 0777)) { |
|
405 | + return false; |
|
406 | + } |
|
390 | 407 | } |
391 | 408 | } |
392 | 409 | return true; |
@@ -401,12 +418,14 @@ discard block |
||
401 | 418 | */ |
402 | 419 | public function rmdir($dir) |
403 | 420 | { |
404 | - if (is_null($dir) || empty($dir)) |
|
405 | - throw new Exception("Missing parameter for rmdir!"); |
|
421 | + if (is_null($dir) || empty($dir)) { |
|
422 | + throw new Exception("Missing parameter for rmdir!"); |
|
423 | + } |
|
406 | 424 | |
407 | - if (rmdir($dir)) |
|
408 | - return true; |
|
409 | - else |
|
410 | - return false; |
|
425 | + if (rmdir($dir)) { |
|
426 | + return true; |
|
427 | + } else { |
|
428 | + return false; |
|
429 | + } |
|
411 | 430 | } |
412 | 431 | } |
413 | 432 | \ No newline at end of file |
@@ -74,18 +74,21 @@ discard block |
||
74 | 74 | { |
75 | 75 | @include_once 'System.php'; |
76 | 76 | |
77 | - if (!class_exists('System', false)) |
|
78 | - throw new \RuntimeException("PEAR is not installed in your system!"); |
|
77 | + if (!class_exists('System', false)) { |
|
78 | + throw new \RuntimeException("PEAR is not installed in your system!"); |
|
79 | + } |
|
79 | 80 | |
80 | 81 | include_once 'Net/SMTP.php'; |
81 | 82 | |
82 | - if (!class_exists('\Net_SMTP', false)) |
|
83 | - throw new \RuntimeException("PEAR::Net_SMTP is not installed!"); |
|
83 | + if (!class_exists('\Net_SMTP', false)) { |
|
84 | + throw new \RuntimeException("PEAR::Net_SMTP is not installed!"); |
|
85 | + } |
|
84 | 86 | |
85 | 87 | @include_once 'Mail.php'; |
86 | 88 | |
87 | - if (!class_exists('\Mail', false)) |
|
88 | - throw new \RuntimeException("PEAR::Mail is not installed!"); |
|
89 | + if (!class_exists('\Mail', false)) { |
|
90 | + throw new \RuntimeException("PEAR::Mail is not installed!"); |
|
91 | + } |
|
89 | 92 | } |
90 | 93 | |
91 | 94 | /** |
@@ -98,8 +101,9 @@ discard block |
||
98 | 101 | */ |
99 | 102 | protected function error($code, $message = null) |
100 | 103 | { |
101 | - if (!array_key_exists($code, $this->errors)) |
|
102 | - $this->errors[$message] = (is_null($message) && array_key_exists($code, $this->errors)) ? $this->errors[$code] : $message; |
|
104 | + if (!array_key_exists($code, $this->errors)) { |
|
105 | + $this->errors[$message] = (is_null($message) && array_key_exists($code, $this->errors)) ? $this->errors[$code] : $message; |
|
106 | + } |
|
103 | 107 | } |
104 | 108 | |
105 | 109 | /** |