Completed
Push — master ( 2c5e95...65df8e )
by Pavel
01:59
created
ParametersHandler.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -18,94 +18,94 @@
 block discarded – undo
18 18
             throw new \InvalidArgumentException('The extra.build-parameters setting must be an array or a configuration object.');
19 19
         }
20 20
 
21
-	    if (!isset($configs['build-folder'])) {
22
-		    $configs['build-folder'] = 'build';
23
-	    }
21
+        if (!isset($configs['build-folder'])) {
22
+            $configs['build-folder'] = 'build';
23
+        }
24 24
 
25
-	    self::initBuildDirectory($configs['build-folder']);
25
+        self::initBuildDirectory($configs['build-folder']);
26 26
         self::processFiles($configs, $event);
27 27
         self::processIncenteevParameters($configs, $event);
28 28
     }
29 29
 
30
-	private static function processIncenteevParameters($configs, $event) {
31
-    	if (!isset($configs['incenteev-parameters'])) {
32
-    		return true;
33
-	    }
34
-
35
-		$processor = new Processor($event->getIO());
36
-		$parameters = $configs['incenteev-parameters'];
37
-		if (array_keys($parameters) !== range(0, count($parameters) - 1)) {
38
-			$parameters = array($parameters);
39
-		}
40
-
41
-		foreach ($parameters as $config) {
42
-			if (!is_array($config)) {
43
-				throw new \InvalidArgumentException('The extra.build-parameters setting must be an array of configuration objects.');
44
-			}
45
-
46
-			$file = self::preparePath($config['file'], $event);
47
-
48
-			$config['dist-file'] = $file;
49
-			$config['file'] = $configs['build-folder'] . '/' . (isset($config['name'])? $config['name'] : $file);
50
-			$processor->processFile($config);
51
-			self::processFile($config);
52
-		}
30
+    private static function processIncenteevParameters($configs, $event) {
31
+        if (!isset($configs['incenteev-parameters'])) {
32
+            return true;
33
+        }
34
+
35
+        $processor = new Processor($event->getIO());
36
+        $parameters = $configs['incenteev-parameters'];
37
+        if (array_keys($parameters) !== range(0, count($parameters) - 1)) {
38
+            $parameters = array($parameters);
39
+        }
40
+
41
+        foreach ($parameters as $config) {
42
+            if (!is_array($config)) {
43
+                throw new \InvalidArgumentException('The extra.build-parameters setting must be an array of configuration objects.');
44
+            }
45
+
46
+            $file = self::preparePath($config['file'], $event);
47
+
48
+            $config['dist-file'] = $file;
49
+            $config['file'] = $configs['build-folder'] . '/' . (isset($config['name'])? $config['name'] : $file);
50
+            $processor->processFile($config);
51
+            self::processFile($config);
52
+        }
53 53
     }
54 54
 
55
-	private static function preparePath($path, $event) {
56
-		if (($env = self::getEnvParameter($event)) !== false) {
57
-			return str_replace("{env}", $env, $path);
58
-		} else {
59
-			return $path;
60
-		}
61
-	}
55
+    private static function preparePath($path, $event) {
56
+        if (($env = self::getEnvParameter($event)) !== false) {
57
+            return str_replace("{env}", $env, $path);
58
+        } else {
59
+            return $path;
60
+        }
61
+    }
62 62
 
63 63
     private static function getEnvParameter(Event $event) {
64
-    	$arguments = $event->getArguments();
65
-		if (!is_array($arguments)) {
66
-			return false;
67
-		}
68
-
69
-	    return array_reduce($arguments, function($ret, $item) {
70
-			if (substr(strtolower($item), 0, 5) == '--env') {
71
-				$val = explode('=', $item);
72
-				return trim($val[1]);
73
-			}
74
-		}, false);
64
+        $arguments = $event->getArguments();
65
+        if (!is_array($arguments)) {
66
+            return false;
67
+        }
68
+
69
+        return array_reduce($arguments, function($ret, $item) {
70
+            if (substr(strtolower($item), 0, 5) == '--env') {
71
+                $val = explode('=', $item);
72
+                return trim($val[1]);
73
+            }
74
+        }, false);
75 75
 
76 76
     }
77 77
 
78
-	private static function processFiles($configs, $event) {
79
-		if (!isset($configs['files'])) {
80
-			return true;
81
-		}
82
-
83
-		$files = $configs['files'];
84
-		if (array_keys($files) !== range(0, count($files) - 1)) {
85
-			$files = array($files);
86
-		}
87
-		foreach ($files as $file) {
88
-			if (!is_array($file)) {
89
-				throw new \InvalidArgumentException('The extra.files setting must be an array of configuration objects.');
90
-			}
91
-
92
-			$path = self::preparePath($file['file'], $event);
93
-			$destination = $configs['build-folder'] . '/' . (isset($file['name']) ? $file['name'] : $path);
94
-			copy($path, $destination);
78
+    private static function processFiles($configs, $event) {
79
+        if (!isset($configs['files'])) {
80
+            return true;
81
+        }
82
+
83
+        $files = $configs['files'];
84
+        if (array_keys($files) !== range(0, count($files) - 1)) {
85
+            $files = array($files);
86
+        }
87
+        foreach ($files as $file) {
88
+            if (!is_array($file)) {
89
+                throw new \InvalidArgumentException('The extra.files setting must be an array of configuration objects.');
90
+            }
91
+
92
+            $path = self::preparePath($file['file'], $event);
93
+            $destination = $configs['build-folder'] . '/' . (isset($file['name']) ? $file['name'] : $path);
94
+            copy($path, $destination);
95 95
             if (isset($file['name'])) {
96 96
                 $event->getIO()->write(sprintf('<info>Copying the "%s" into "%s" file</info>', $path, $destination));
97 97
             } else {
98 98
                 $event->getIO()->write(sprintf('<info>Copying the "%s" file</info>', $path));
99 99
             }
100 100
 
101
-		}
102
-	}
101
+        }
102
+    }
103 103
 
104
-	private static function initBuildDirectory($dir) {
105
-		if (!is_dir($dir)) {
104
+    private static function initBuildDirectory($dir) {
105
+        if (!is_dir($dir)) {
106 106
             mkdir($dir);
107 107
         }
108
-	}
108
+    }
109 109
 
110 110
     private static function processFile($config)
111 111
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 			$file = self::preparePath($config['file'], $event);
47 47
 
48 48
 			$config['dist-file'] = $file;
49
-			$config['file'] = $configs['build-folder'] . '/' . (isset($config['name'])? $config['name'] : $file);
49
+			$config['file'] = $configs['build-folder'] . '/' . (isset($config['name']) ? $config['name'] : $file);
50 50
 			$processor->processFile($config);
51 51
 			self::processFile($config);
52 52
 		}
Please login to merge, or discard this patch.
src/IncenteevParametersProcessor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 
59 59
 
60 60
             $config['dist-file'] = $config['file'];
61
-            $config['file'] = $configs['build-folder'] . '/' . (isset($config['name'])? $config['name'] : $file);
61
+            $config['file'] = $configs['build-folder'] . '/' . (isset($config['name']) ? $config['name'] : $file);
62 62
             $this->processFile($config['dist-file'], $config['file']);
63 63
 
64 64
             $config['dist-file'] = $config['file'];
Please login to merge, or discard this patch.
src/ParametersHandler.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
             throw new \InvalidArgumentException('The extra.build-parameters setting must be an array or a configuration object.');
18 18
         }
19 19
 
20
-	    $fileHandler = new FileHandler($event->getIO());
20
+        $fileHandler = new FileHandler($event->getIO());
21 21
 
22 22
         if (!isset($configs['build-folder'])) {
23 23
             $configs['build-folder'] = 'build';
24 24
         }
25 25
         $fileHandler->initDirectory($configs['build-folder']);
26 26
 
27
-	    $fileProcessor = new FileProcessor($event->getIO(), $fileHandler);
27
+        $fileProcessor = new FileProcessor($event->getIO(), $fileHandler);
28 28
         $fileProcessor->process($configs, $event);
29 29
 
30 30
         $incenteevProcessor = new IncenteevParametersProcessor($event->getIO(), $fileHandler);
Please login to merge, or discard this patch.