Passed
Push — master ( 8dd9cb...18e8f6 )
by Mihail
02:46
created
src/Application.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 					if (!is_dir(dirname($file))) mkdir(dirname($file), $this->chmod, true);
92 92
 					touch($path . DIRECTORY_SEPARATOR . $item);
93 93
 				} else if ($section == 'links') {
94
-					$link = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[0]);
95
-					$target = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[1]);
94
+					$link = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[ 0 ]);
95
+					$target = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[ 1 ]);
96 96
 					if (!is_dir(dirname($link))) mkdir(dirname($link), $this->chmod, true);
97 97
 					symlink($target, $link);
98 98
 				}
@@ -108,21 +108,21 @@  discard block
 block discarded – undo
108 108
 		$directory = new \RecursiveDirectoryIterator(realpath($path), \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS);
109 109
 		$iterator = new \RecursiveIteratorIterator($directory, \RecursiveIteratorIterator::SELF_FIRST);
110 110
 
111
-		$items = [];
111
+		$items = [ ];
112 112
 		foreach ($iterator as $item) {
113
-			$items[] = $item;
113
+			$items[ ] = $item;
114 114
 		}
115 115
 
116
-		if (empty($items)) return [];
116
+		if (empty($items)) return [ ];
117 117
 
118
-		$structure = [];
118
+		$structure = [ ];
119 119
 		foreach ($items as $item) {
120 120
 			if (is_link($item)) {
121
-				$structure['links'][] = str_ireplace(realpath($path) . DIRECTORY_SEPARATOR, '', $item) . ':' . str_ireplace(realpath($path) . DIRECTORY_SEPARATOR, '', readlink($item));
121
+				$structure[ 'links' ][ ] = str_ireplace(realpath($path) . DIRECTORY_SEPARATOR, '', $item) . ':' . str_ireplace(realpath($path) . DIRECTORY_SEPARATOR, '', readlink($item));
122 122
 			} else if (is_file($item)) {
123
-				$structure['files'][] = str_ireplace(realpath($path) . DIRECTORY_SEPARATOR, '', $item);
123
+				$structure[ 'files' ][ ] = str_ireplace(realpath($path) . DIRECTORY_SEPARATOR, '', $item);
124 124
 			} else if (is_dir($item)) {
125
-				$structure['dirs'][] = str_ireplace(realpath($path) . DIRECTORY_SEPARATOR, '', $item);
125
+				$structure[ 'dirs' ][ ] = str_ireplace(realpath($path) . DIRECTORY_SEPARATOR, '', $item);
126 126
 			}
127 127
 		}
128 128
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	public function sortStructure(array $structure) {
133 133
 		ksort($structure);
134 134
 
135
-		$structure = array_map(function ($item) {
135
+		$structure = array_map(function($item) {
136 136
 			sort($item);
137 137
 			return $item;
138 138
 		}, $structure);
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	}
142 142
 
143 143
 	public function diffStructure(array $structureThin, array $structureFat) {
144
-		if (empty($structureThin)) return [];
145
-		if (empty($structureFat)) return [];
144
+		if (empty($structureThin)) return [ ];
145
+		if (empty($structureFat)) return [ ];
146 146
 
147
-		$structureDiff = [];
147
+		$structureDiff = [ ];
148 148
 
149 149
 		foreach ($structureFat as $section => $items) {
150
-			if (empty($structureThin[$section])) continue;
151
-			$diff = array_diff($items, $structureThin[$section]);
150
+			if (empty($structureThin[ $section ])) continue;
151
+			$diff = array_diff($items, $structureThin[ $section ]);
152 152
 			if (empty($diff)) continue;
153
-			$structureDiff[$section] = $diff;
153
+			$structureDiff[ $section ] = $diff;
154 154
 		}
155 155
 
156 156
 		return $structureDiff;
@@ -159,20 +159,20 @@  discard block
 block discarded – undo
159 159
 	public function toRealpaths($path, array $structure) {
160 160
 		if (empty($path)) throw new \InvalidArgumentException('empty path');
161 161
 
162
-		if (empty($structure)) return [];
162
+		if (empty($structure)) return [ ];
163 163
 
164
-		$realpaths = [];
164
+		$realpaths = [ ];
165 165
 
166 166
 		foreach ($structure as $section => $items) {
167 167
 			if (empty($items)) continue;
168 168
 			foreach ($items as $item) {
169 169
 				if (empty($item)) continue;
170 170
 				if ($section == 'links') {
171
-					$realpaths[] = realpath($path) . DIRECTORY_SEPARATOR . explode(':', $item)[0];
171
+					$realpaths[ ] = realpath($path) . DIRECTORY_SEPARATOR . explode(':', $item)[ 0 ];
172 172
 				} else if ($section == 'files') {
173
-					$realpaths[] = realpath($path) . DIRECTORY_SEPARATOR . $item;
173
+					$realpaths[ ] = realpath($path) . DIRECTORY_SEPARATOR . $item;
174 174
 				} else if ($section == 'dirs') {
175
-					$realpaths[] = realpath($path) . DIRECTORY_SEPARATOR . $item;
175
+					$realpaths[ ] = realpath($path) . DIRECTORY_SEPARATOR . $item;
176 176
 				}
177 177
 			}
178 178
 		}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		}
200 200
 
201 201
 		$path = $this->absolutePath($path, getcwd());
202
-		$messages = [];
202
+		$messages = [ ];
203 203
 
204 204
 		foreach ($this->structure as $section => $items) {
205 205
 			if (empty($items)) continue;
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 				if (empty($item)) continue;
208 208
 				if ($section == 'dirs') {
209 209
 					$dir = $path . DIRECTORY_SEPARATOR . $item;
210
-					if (!is_dir($dir)) $messages[] = 'directory "' . $dir . '" not found';
210
+					if (!is_dir($dir)) $messages[ ] = 'directory "' . $dir . '" not found';
211 211
 				} else if ($section == 'files') {
212 212
 					$file = $path . DIRECTORY_SEPARATOR . $item;
213
-					if (!is_file($file)) $messages[] = 'file "' . $file . '" not found';
213
+					if (!is_file($file)) $messages[ ] = 'file "' . $file . '" not found';
214 214
 				} else if ($section == 'links') {
215
-					$link = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[0]);
216
-					if (!is_link($link)) $messages[] = 'link "' . realpath($link) . '" not found';
215
+					$link = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[ 0 ]);
216
+					if (!is_link($link)) $messages[ ] = 'link "' . realpath($link) . '" not found';
217 217
 				}
218 218
 			}
219 219
 		}
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
 		}
247 247
 
248 248
 		$path = $this->absolutePath($path, getcwd());
249
-		$messages = [];
249
+		$messages = [ ];
250 250
 
251 251
 		if (!is_dir($path)) {
252 252
 			if (mkdir($path, $this->chmod, true)) {
253
-				$messages[] = 'directory "' . realpath($path) . '" created';
253
+				$messages[ ] = 'directory "' . realpath($path) . '" created';
254 254
 			} else {
255 255
 				$payload->setType(Payload::STRUCTURE_INIT_FAIL);
256 256
 				$payload->setMessage('directory "' . $path . '" does not created');
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 				if ($section == 'dirs') {
267 267
 					$dir = $path . DIRECTORY_SEPARATOR . $item;
268 268
 					if (mkdir($dir, $this->chmod, true)) {
269
-						$messages[] = 'directory "' . $dir . '" created';
269
+						$messages[ ] = 'directory "' . $dir . '" created';
270 270
 					} else {
271 271
 						$payload->setType(Payload::STRUCTURE_INIT_FAIL);
272 272
 						$payload->setMessage('directory "' . $dir . '" does not created');
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 				} else if ($section == 'files') {
277 277
 					$file = $path . DIRECTORY_SEPARATOR . $item;
278 278
 					if (touch($file)) {
279
-						$messages[] = 'file "' . $file . '" created';
279
+						$messages[ ] = 'file "' . $file . '" created';
280 280
 					} else {
281 281
 						$payload->setType(Payload::STRUCTURE_INIT_FAIL);
282 282
 						$payload->setMessage('file"' . $file . '" does not created');
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 						return $payload;
285 285
 					}
286 286
 				} else if ($section == 'links') {
287
-					$target = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[1]);
288
-					$link = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[0]);
287
+					$target = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[ 1 ]);
288
+					$link = $path . DIRECTORY_SEPARATOR . (explode(':', $item)[ 0 ]);
289 289
 					if (symlink($target, $link)) {
290
-						$messages[] = 'link "' . $link . '" created';
290
+						$messages[ ] = 'link "' . $link . '" created';
291 291
 					} else {
292 292
 						$payload->setType(Payload::STRUCTURE_INIT_FAIL);
293 293
 						$payload->setMessage('link ' . $link . '" does not created');
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		}
331 331
 
332 332
 		$payload->setType(Payload::STRUCTURE_CLEAN_SUCCESS);
333
-		$payload->setMessage(array_merge(['cleaned items:'], $realpathsDiff));
333
+		$payload->setMessage(array_merge([ 'cleaned items:' ], $realpathsDiff));
334 334
 		$payload->setCode(0);
335 335
 		return $payload;
336 336
 	}
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 			return $payload;
478 478
 		}
479 479
 
480
-		$dirs = array_map(function ($path) {
480
+		$dirs = array_map(function($path) {
481 481
 			return basename($path);
482 482
 		}, $dirs);
483 483
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 			return $payload;
513 513
 		}
514 514
 
515
-		$dirs = array_map(function ($path) {
515
+		$dirs = array_map(function($path) {
516 516
 			return basename($path);
517 517
 		}, $dirs);
518 518
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 		if (empty($path)) throw new \InvalidArgumentException('empty path');
661 661
 		if (empty($cwd)) throw new \InvalidArgumentException('empty cwd');
662 662
 
663
-		if ($path[0] == '/') return $path;
663
+		if ($path[ 0 ] == '/') return $path;
664 664
 
665 665
 		return $cwd . DIRECTORY_SEPARATOR . $path;
666 666
 	}
Please login to merge, or discard this patch.