@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $path = $this->absolutePath($path, getcwd()); |
| 88 | - $messages = []; |
|
| 88 | + $messages = [ ]; |
|
| 89 | 89 | |
| 90 | 90 | if (!is_dir($path)) { |
| 91 | 91 | if (mkdir($path, 0777, true)) { |
| 92 | - $messages[] = 'directory "' . realpath($path) . '" created'; |
|
| 92 | + $messages[ ] = 'directory "' . realpath($path) . '" created'; |
|
| 93 | 93 | } else { |
| 94 | 94 | $payload->setType(Payload::STRUCTURE_INIT_FAIL); |
| 95 | 95 | $payload->setMessage('directory "' . $path . '" does not created'); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $releasesDir = $path . DIRECTORY_SEPARATOR . 'releases'; |
| 102 | 102 | if (!is_dir($releasesDir)) { |
| 103 | 103 | if (mkdir($releasesDir, 0777, true)) { |
| 104 | - $messages[] = 'directory "' . realpath($releasesDir) . '" created'; |
|
| 104 | + $messages[ ] = 'directory "' . realpath($releasesDir) . '" created'; |
|
| 105 | 105 | } else { |
| 106 | 106 | $payload->setType(Payload::STRUCTURE_INIT_FAIL); |
| 107 | 107 | $payload->setMessage('directory "' . $releasesDir . '" does not created'); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $sharedDir = $path . DIRECTORY_SEPARATOR . 'shared'; |
| 114 | 114 | if (!is_dir($sharedDir)) { |
| 115 | 115 | if (mkdir($sharedDir, 0777, true)) { |
| 116 | - $messages[] = 'directory "' . realpath($sharedDir) . '" created'; |
|
| 116 | + $messages[ ] = 'directory "' . realpath($sharedDir) . '" created'; |
|
| 117 | 117 | } else { |
| 118 | 118 | $payload->setType(Payload::STRUCTURE_INIT_FAIL); |
| 119 | 119 | $payload->setMessage('directory "' . $sharedDir . '" does not created'); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $logFile = $path . DIRECTORY_SEPARATOR . 'deploid.log'; |
| 126 | 126 | if (!is_file($logFile)) { |
| 127 | 127 | if (touch($logFile)) { |
| 128 | - $messages[] = 'file "' . realpath($logFile) . '" created'; |
|
| 128 | + $messages[ ] = 'file "' . realpath($logFile) . '" created'; |
|
| 129 | 129 | } else { |
| 130 | 130 | $payload->setType(Payload::STRUCTURE_INIT_FAIL); |
| 131 | 131 | $payload->setMessage('file"' . $logFile . '" does not created'); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | 'deploid.log', |
| 166 | 166 | ]; |
| 167 | 167 | |
| 168 | - $paths = array_filter($paths, function ($path) use ($needed) { |
|
| 168 | + $paths = array_filter($paths, function($path) use ($needed) { |
|
| 169 | 169 | return !in_array(basename($path), $needed); |
| 170 | 170 | }); |
| 171 | 171 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $payload->setType(Payload::STRUCTURE_CLEAN_SUCCESS); |
| 181 | - $payload->setMessage(array_merge(['cleaned items:'], $paths)); |
|
| 181 | + $payload->setMessage(array_merge([ 'cleaned items:' ], $paths)); |
|
| 182 | 182 | $payload->setCode(0); |
| 183 | 183 | return $payload; |
| 184 | 184 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | return $payload; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - $dirs = array_map(function ($path) { |
|
| 328 | + $dirs = array_map(function($path) { |
|
| 329 | 329 | return basename($path); |
| 330 | 330 | }, $dirs); |
| 331 | 331 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | return $payload; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $dirs = array_map(function ($path) { |
|
| 363 | + $dirs = array_map(function($path) { |
|
| 364 | 364 | return basename($path); |
| 365 | 365 | }, $dirs); |
| 366 | 366 | |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | public function absolutePath($path, $cwd) { |
| 508 | - if ($path[0] == '/') return $path; |
|
| 508 | + if ($path[ 0 ] == '/') return $path; |
|
| 509 | 509 | return $cwd . DIRECTORY_SEPARATOR . $path; |
| 510 | 510 | } |
| 511 | 511 | |
@@ -493,7 +493,9 @@ discard block |
||
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | foreach (array_reverse($releases) as $idx => $release) { |
| 496 | - if ($idx <= ($quantity - 1)) continue; |
|
| 496 | + if ($idx <= ($quantity - 1)) { |
|
| 497 | + continue; |
|
| 498 | + } |
|
| 497 | 499 | $proccess = new Process('rm -r ' . $release); |
| 498 | 500 | $proccess->run(); |
| 499 | 501 | } |
@@ -505,7 +507,9 @@ discard block |
||
| 505 | 507 | } |
| 506 | 508 | |
| 507 | 509 | public function absolutePath($path, $cwd) { |
| 508 | - if ($path[0] == '/') return $path; |
|
| 510 | + if ($path[0] == '/') { |
|
| 511 | + return $path; |
|
| 512 | + } |
|
| 509 | 513 | return $cwd . DIRECTORY_SEPARATOR . $path; |
| 510 | 514 | } |
| 511 | 515 | |