Test Failed
Push — master ( 8c0020...13ad3b )
by Mihail
01:58
created
src/Application.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			foreach ($items as $item) {
72 72
 				if ($section == 'dirs' && strlen($item)) mkdir($path . DIRECTORY_SEPARATOR . $item, 0777, true);
73 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]));
74
+				if ($section == 'links' && strlen($item)) symlink($path . DIRECTORY_SEPARATOR . (explode(':', $item)[ 1 ]), $path . DIRECTORY_SEPARATOR . (explode(':', $item)[ 0 ]));
75 75
 			}
76 76
 		}
77 77
 
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 		}
135 135
 
136 136
 		$path = $this->absolutePath($path, getcwd());
137
-		$messages = [];
137
+		$messages = [ ];
138 138
 
139 139
 		if (!is_dir($path)) {
140 140
 			if (mkdir($path, 0777, true)) {
141
-				$messages[] = 'directory "' . realpath($path) . '" created';
141
+				$messages[ ] = 'directory "' . realpath($path) . '" created';
142 142
 			} else {
143 143
 				$payload->setType(Payload::STRUCTURE_INIT_FAIL);
144 144
 				$payload->setMessage('directory "' . $path . '" does not created');
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		$releasesDir = $path . DIRECTORY_SEPARATOR . 'releases';
151 151
 		if (!is_dir($releasesDir)) {
152 152
 			if (mkdir($releasesDir, 0777, true)) {
153
-				$messages[] = 'directory "' . realpath($releasesDir) . '" created';
153
+				$messages[ ] = 'directory "' . realpath($releasesDir) . '" created';
154 154
 			} else {
155 155
 				$payload->setType(Payload::STRUCTURE_INIT_FAIL);
156 156
 				$payload->setMessage('directory "' . $releasesDir . '" does not created');
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		$sharedDir = $path . DIRECTORY_SEPARATOR . 'shared';
163 163
 		if (!is_dir($sharedDir)) {
164 164
 			if (mkdir($sharedDir, 0777, true)) {
165
-				$messages[] = 'directory "' . realpath($sharedDir) . '" created';
165
+				$messages[ ] = 'directory "' . realpath($sharedDir) . '" created';
166 166
 			} else {
167 167
 				$payload->setType(Payload::STRUCTURE_INIT_FAIL);
168 168
 				$payload->setMessage('directory "' . $sharedDir . '" does not created');
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		$logFile = $path . DIRECTORY_SEPARATOR . 'deploid.log';
175 175
 		if (!is_file($logFile)) {
176 176
 			if (touch($logFile)) {
177
-				$messages[] = 'file "' . realpath($logFile) . '" created';
177
+				$messages[ ] = 'file "' . realpath($logFile) . '" created';
178 178
 			} else {
179 179
 				$payload->setType(Payload::STRUCTURE_INIT_FAIL);
180 180
 				$payload->setMessage('file"' . $logFile . '" does not created');
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$paths = glob(realpath($path) . DIRECTORY_SEPARATOR . '*');
209 209
 
210
-		$paths = array_filter($paths, function ($path) {
211
-			return !in_array(basename($path), $this->structure['dirs'] + $this->structure['links'] + $this->structure['files']);
210
+		$paths = array_filter($paths, function($path) {
211
+			return !in_array(basename($path), $this->structure[ 'dirs' ] + $this->structure[ 'links' ] + $this->structure[ 'files' ]);
212 212
 		});
213 213
 
214 214
 		foreach ($paths as $pathname) {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		}
221 221
 
222 222
 		$payload->setType(Payload::STRUCTURE_CLEAN_SUCCESS);
223
-		$payload->setMessage(array_merge(['cleaned items:'], $paths));
223
+		$payload->setMessage(array_merge([ 'cleaned items:' ], $paths));
224 224
 		$payload->setCode(0);
225 225
 		return $payload;
226 226
 	}
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 			return $payload;
368 368
 		}
369 369
 
370
-		$dirs = array_map(function ($path) {
370
+		$dirs = array_map(function($path) {
371 371
 			return basename($path);
372 372
 		}, $dirs);
373 373
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			return $payload;
403 403
 		}
404 404
 
405
-		$dirs = array_map(function ($path) {
405
+		$dirs = array_map(function($path) {
406 406
 			return basename($path);
407 407
 		}, $dirs);
408 408
 
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		if (empty($path)) throw new \InvalidArgumentException('empty path');
551 551
 		if (empty($cwd)) throw new \InvalidArgumentException('empty cwd');
552 552
 
553
-		if ($path[0] == '/') return $path;
553
+		if ($path[ 0 ] == '/') return $path;
554 554
 
555 555
 		return $cwd . DIRECTORY_SEPARATOR . $path;
556 556
 	}
Please login to merge, or discard this patch.
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -64,14 +64,24 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.