@@ -78,7 +78,9 @@ |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | public function setCode($code) { |
81 | - if (!\is_numeric($code)) throw new \InvalidArgumentException('expected numeric'); |
|
81 | + if (!\is_numeric($code)) { |
|
82 | + throw new \InvalidArgumentException('expected numeric'); |
|
83 | + } |
|
82 | 84 | $this->code = $code; |
83 | 85 | return $this; |
84 | 86 | } |
@@ -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 |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $path = $this->absolutePath($path, getcwd()); |
104 | - $messages = []; |
|
104 | + $messages = [ ]; |
|
105 | 105 | |
106 | 106 | if (!is_dir($path)) { |
107 | 107 | if (mkdir($path, 0777, true)) { |
108 | - $messages[] = 'directory "' . realpath($path) . '" created'; |
|
108 | + $messages[ ] = 'directory "' . realpath($path) . '" created'; |
|
109 | 109 | } else { |
110 | 110 | $payload->setType(Payload::STRUCTURE_INIT_FAIL); |
111 | 111 | $payload->setMessage('directory "' . $path . '" does not created'); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $releasesDir = $path . DIRECTORY_SEPARATOR . 'releases'; |
118 | 118 | if (!is_dir($releasesDir)) { |
119 | 119 | if (mkdir($releasesDir, 0777, true)) { |
120 | - $messages[] = 'directory "' . realpath($releasesDir) . '" created'; |
|
120 | + $messages[ ] = 'directory "' . realpath($releasesDir) . '" created'; |
|
121 | 121 | } else { |
122 | 122 | $payload->setType(Payload::STRUCTURE_INIT_FAIL); |
123 | 123 | $payload->setMessage('directory "' . $releasesDir . '" does not created'); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $sharedDir = $path . DIRECTORY_SEPARATOR . 'shared'; |
130 | 130 | if (!is_dir($sharedDir)) { |
131 | 131 | if (mkdir($sharedDir, 0777, true)) { |
132 | - $messages[] = 'directory "' . realpath($sharedDir) . '" created'; |
|
132 | + $messages[ ] = 'directory "' . realpath($sharedDir) . '" created'; |
|
133 | 133 | } else { |
134 | 134 | $payload->setType(Payload::STRUCTURE_INIT_FAIL); |
135 | 135 | $payload->setMessage('directory "' . $sharedDir . '" does not created'); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $logFile = $path . DIRECTORY_SEPARATOR . 'deploid.log'; |
142 | 142 | if (!is_file($logFile)) { |
143 | 143 | if (touch($logFile)) { |
144 | - $messages[] = 'file "' . realpath($logFile) . '" created'; |
|
144 | + $messages[ ] = 'file "' . realpath($logFile) . '" created'; |
|
145 | 145 | } else { |
146 | 146 | $payload->setType(Payload::STRUCTURE_INIT_FAIL); |
147 | 147 | $payload->setMessage('file"' . $logFile . '" does not created'); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | $paths = glob(realpath($path) . DIRECTORY_SEPARATOR . '*'); |
176 | 176 | |
177 | - $paths = array_filter($paths, function ($path) { |
|
177 | + $paths = array_filter($paths, function($path) { |
|
178 | 178 | return !in_array(basename($path), $this->structure); |
179 | 179 | }); |
180 | 180 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | $payload->setType(Payload::STRUCTURE_CLEAN_SUCCESS); |
190 | - $payload->setMessage(array_merge(['cleaned items:'], $paths)); |
|
190 | + $payload->setMessage(array_merge([ 'cleaned items:' ], $paths)); |
|
191 | 191 | $payload->setCode(0); |
192 | 192 | return $payload; |
193 | 193 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | return $payload; |
335 | 335 | } |
336 | 336 | |
337 | - $dirs = array_map(function ($path) { |
|
337 | + $dirs = array_map(function($path) { |
|
338 | 338 | return basename($path); |
339 | 339 | }, $dirs); |
340 | 340 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | return $payload; |
370 | 370 | } |
371 | 371 | |
372 | - $dirs = array_map(function ($path) { |
|
372 | + $dirs = array_map(function($path) { |
|
373 | 373 | return basename($path); |
374 | 374 | }, $dirs); |
375 | 375 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | } |
515 | 515 | |
516 | 516 | public function absolutePath($path, $cwd) { |
517 | - if ($path[0] == '/') return $path; |
|
517 | + if ($path[ 0 ] == '/') return $path; |
|
518 | 518 | return $cwd . DIRECTORY_SEPARATOR . $path; |
519 | 519 | } |
520 | 520 |