@@ -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 | } |
@@ -64,14 +64,24 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function makeStructure($path, array $structure) { |
| 67 | - if (empty($path)) throw new \InvalidArgumentException('empty path'); |
|
| 68 | - if (empty($structure)) throw new \InvalidArgumentException('empty structure'); |
|
| 67 | + if (empty($path)) { |
|
| 68 | + throw new \InvalidArgumentException('empty path'); |
|
| 69 | + } |
|
| 70 | + if (empty($structure)) { |
|
| 71 | + throw new \InvalidArgumentException('empty structure'); |
|
| 72 | + } |
|
| 69 | 73 | |
| 70 | 74 | foreach ($structure as $section => $items) { |
| 71 | 75 | foreach ($items as $item) { |
| 72 | - if ($section == 'dirs' && strlen($item)) mkdir($path . DIRECTORY_SEPARATOR . $item, 0777, true); |
|
| 73 | - if ($section == 'files' && strlen($item)) touch($path . DIRECTORY_SEPARATOR . $item); |
|
| 74 | - if ($section == 'links' && strlen($item)) symlink($path . DIRECTORY_SEPARATOR . (explode(':', $item)[1]), $path . DIRECTORY_SEPARATOR . (explode(':', $item)[0])); |
|
| 76 | + if ($section == 'dirs' && strlen($item)) { |
|
| 77 | + mkdir($path . DIRECTORY_SEPARATOR . $item, 0777, true); |
|
| 78 | + } |
|
| 79 | + if ($section == 'files' && strlen($item)) { |
|
| 80 | + touch($path . DIRECTORY_SEPARATOR . $item); |
|
| 81 | + } |
|
| 82 | + if ($section == 'links' && strlen($item)) { |
|
| 83 | + symlink($path . DIRECTORY_SEPARATOR . (explode(':', $item)[1]), $path . DIRECTORY_SEPARATOR . (explode(':', $item)[0])); |
|
| 84 | + } |
|
| 75 | 85 | } |
| 76 | 86 | } |
| 77 | 87 | |
@@ -535,7 +545,9 @@ discard block |
||
| 535 | 545 | } |
| 536 | 546 | |
| 537 | 547 | foreach (array_reverse($releases) as $idx => $release) { |
| 538 | - if ($idx <= ($quantity - 1)) continue; |
|
| 548 | + if ($idx <= ($quantity - 1)) { |
|
| 549 | + continue; |
|
| 550 | + } |
|
| 539 | 551 | $proccess = new Process('rm -r ' . $release); |
| 540 | 552 | $proccess->run(); |
| 541 | 553 | } |
@@ -547,10 +559,16 @@ discard block |
||
| 547 | 559 | } |
| 548 | 560 | |
| 549 | 561 | public function absolutePath($path, $cwd) { |
| 550 | - if (empty($path)) throw new \InvalidArgumentException('empty path'); |
|
| 551 | - if (empty($cwd)) throw new \InvalidArgumentException('empty cwd'); |
|
| 562 | + if (empty($path)) { |
|
| 563 | + throw new \InvalidArgumentException('empty path'); |
|
| 564 | + } |
|
| 565 | + if (empty($cwd)) { |
|
| 566 | + throw new \InvalidArgumentException('empty cwd'); |
|
| 567 | + } |
|
| 552 | 568 | |
| 553 | - if ($path[0] == '/') return $path; |
|
| 569 | + if ($path[0] == '/') { |
|
| 570 | + return $path; |
|
| 571 | + } |
|
| 554 | 572 | |
| 555 | 573 | return $cwd . DIRECTORY_SEPARATOR . $path; |
| 556 | 574 | } |