@@ -75,16 +75,30 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | public function makeStructure($path, array $structure) { |
| 78 | - if (empty($path)) throw new \InvalidArgumentException('empty path'); |
|
| 79 | - if (empty($structure)) throw new \InvalidArgumentException('empty structure'); |
|
| 78 | + if (empty($path)) { |
|
| 79 | + throw new \InvalidArgumentException('empty path'); |
|
| 80 | + } |
|
| 81 | + if (empty($structure)) { |
|
| 82 | + throw new \InvalidArgumentException('empty structure'); |
|
| 83 | + } |
|
| 80 | 84 | |
| 81 | 85 | foreach ($structure as $section => $items) { |
| 82 | - if (empty($items)) continue; |
|
| 86 | + if (empty($items)) { |
|
| 87 | + continue; |
|
| 88 | + } |
|
| 83 | 89 | foreach ($items as $item) { |
| 84 | - if (empty($item)) continue; |
|
| 85 | - if ($section == 'dirs') mkdir($path . DIRECTORY_SEPARATOR . $item, $this->chmod, true); |
|
| 86 | - if ($section == 'files') touch($path . DIRECTORY_SEPARATOR . $item); |
|
| 87 | - if ($section == 'links') symlink($path . DIRECTORY_SEPARATOR . (explode(':', $item)[1]), $path . DIRECTORY_SEPARATOR . (explode(':', $item)[0])); |
|
| 90 | + if (empty($item)) { |
|
| 91 | + continue; |
|
| 92 | + } |
|
| 93 | + if ($section == 'dirs') { |
|
| 94 | + mkdir($path . DIRECTORY_SEPARATOR . $item, $this->chmod, true); |
|
| 95 | + } |
|
| 96 | + if ($section == 'files') { |
|
| 97 | + touch($path . DIRECTORY_SEPARATOR . $item); |
|
| 98 | + } |
|
| 99 | + if ($section == 'links') { |
|
| 100 | + symlink($path . DIRECTORY_SEPARATOR . (explode(':', $item)[1]), $path . DIRECTORY_SEPARATOR . (explode(':', $item)[0])); |
|
| 101 | + } |
|
| 88 | 102 | } |
| 89 | 103 | } |
| 90 | 104 | |
@@ -161,9 +175,13 @@ discard block |
||
| 161 | 175 | } |
| 162 | 176 | |
| 163 | 177 | foreach ($this->structure as $section => $items) { |
| 164 | - if (empty($items)) continue; |
|
| 178 | + if (empty($items)) { |
|
| 179 | + continue; |
|
| 180 | + } |
|
| 165 | 181 | foreach ($items as $item) { |
| 166 | - if (empty($item)) continue; |
|
| 182 | + if (empty($item)) { |
|
| 183 | + continue; |
|
| 184 | + } |
|
| 167 | 185 | if ($section == 'dirs') { |
| 168 | 186 | $dir = $path . DIRECTORY_SEPARATOR . $item; |
| 169 | 187 | if (mkdir($dir, $this->chmod, true)) { |
@@ -555,7 +573,9 @@ discard block |
||
| 555 | 573 | } |
| 556 | 574 | |
| 557 | 575 | foreach (array_reverse($releases) as $idx => $release) { |
| 558 | - if ($idx <= ($quantity - 1)) continue; |
|
| 576 | + if ($idx <= ($quantity - 1)) { |
|
| 577 | + continue; |
|
| 578 | + } |
|
| 559 | 579 | $proccess = new Process('rm -r ' . $release); |
| 560 | 580 | $proccess->run(); |
| 561 | 581 | } |
@@ -567,10 +587,16 @@ discard block |
||
| 567 | 587 | } |
| 568 | 588 | |
| 569 | 589 | public function absolutePath($path, $cwd) { |
| 570 | - if (empty($path)) throw new \InvalidArgumentException('empty path'); |
|
| 571 | - if (empty($cwd)) throw new \InvalidArgumentException('empty cwd'); |
|
| 590 | + if (empty($path)) { |
|
| 591 | + throw new \InvalidArgumentException('empty path'); |
|
| 592 | + } |
|
| 593 | + if (empty($cwd)) { |
|
| 594 | + throw new \InvalidArgumentException('empty cwd'); |
|
| 595 | + } |
|
| 572 | 596 | |
| 573 | - if ($path[0] == '/') return $path; |
|
| 597 | + if ($path[0] == '/') { |
|
| 598 | + return $path; |
|
| 599 | + } |
|
| 574 | 600 | |
| 575 | 601 | return $cwd . DIRECTORY_SEPARATOR . $path; |
| 576 | 602 | } |