Passed
Branch v2.0.0 (9e1925)
by Deric
02:02
created
lib/Filesystem.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
                 continue;
156 156
             }
157 157
         }
158
-		return true;
158
+        return true;
159 159
     }
160 160
 
161
-	/**
161
+    /**
162 162
      * Returns pathnames matching a pattern (for files only & hidden files).
163 163
      *
164 164
      * @param  string $directory directory
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             return false;
173 173
         }
174 174
 
175
-		$pattern = is_array(($pattern)) ? '{' . implode(',', $pattern) . '}' : $pattern;
175
+        $pattern = is_array(($pattern)) ? '{' . implode(',', $pattern) . '}' : $pattern;
176 176
         if ($pattern === null)
177 177
         {
178 178
             return array_diff(glob($directory . '/*'), ['.', '..']);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
             return false;
173 173
         }
174 174
 
175
-		$pattern = is_array(($pattern)) ? '{' . implode(',', $pattern) . '}' : $pattern;
175
+		$pattern = is_array(($pattern)) ? '{'.implode(',', $pattern).'}' : $pattern;
176 176
         if ($pattern === null)
177 177
         {
178
-            return array_diff(glob($directory . '/*'), ['.', '..']);
178
+            return array_diff(glob($directory.'/*'), ['.', '..']);
179 179
         }
180
-        return glob($directory . '/{,.}*' . $pattern . '*', GLOB_BRACE);
180
+        return glob($directory.'/{,.}*'.$pattern.'*', GLOB_BRACE);
181 181
     }
182 182
 
183 183
     /**
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
             {
270 270
                 if ($file != '.' && $file != '..')
271 271
                 {
272
-                    $files[] = $directory . '/' . $file;
272
+                    $files[] = $directory.'/'.$file;
273 273
                 }
274 274
             }
275 275
         }
Please login to merge, or discard this patch.
lib/Builder.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         {
69 69
             if (preg_match('/^-.*$/', $key, $matches))
70 70
             {
71
-                $options[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value;
71
+                $options[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT).$value;
72 72
             }
73 73
             if (preg_match('/^-.*$/', $value, $matches))
74 74
             {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         {
93 93
             if (preg_match('/^-.*$/', $key, $matches))
94 94
             {
95
-                $arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value;
95
+                $arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT).$value;
96 96
             }
97 97
             else
98 98
             {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,8 +93,7 @@
 block discarded – undo
93 93
             if (preg_match('/^-.*$/', $key, $matches))
94 94
             {
95 95
                 $arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value;
96
-            }
97
-            else
96
+            } else
98 97
             {
99 98
                 $arguments[] = is_array($value) ? implode(' ', $value) : $value;
100 99
             }
Please login to merge, or discard this patch.
lib/Archive.php 2 patches
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -12,197 +12,197 @@
 block discarded – undo
12 12
 class Archive
13 13
 {
14 14
 
15
-	/**
16
-	 * Archive filename.
17
-	 *
18
-	 * @var string
19
-	 */
20
-	private $archive;
21
-
22
-	/**
23
-	 * Files to archive.
24
-	 *
25
-	 * @var array
26
-	 */
27
-	private $files = [];
28
-
29
-	/**
30
-	 * Archive command.
31
-	 *
32
-	 * @var string
33
-	 */
34
-	public $command = '';
35
-
36
-	/**
37
-	 * Strict error checking.
38
-	 *
39
-	 * @var boolean
40
-	 */
41
-	public $strict = false;
42
-
43
-	/**
44
-	 * Constructor.
45
-	 *
46
-	 * @param  string $archive archive filename
47
-	 * @return void
48
-	 */
49
-	public function __construct($archive)
50
-	{
51
-		$this->archive = $archive;
52
-	}
53
-
54
-	/**
55
-	 * Convert object of class to string.
56
-	 *
57
-	 * @return string
58
-	 */
59
-	public function __toString()
60
-	{
61
-		return (string) $this->command;
62
-	}
63
-
64
-	/**
65
-	 * Add files to archive file.
66
-	 *
67
-	 * @param  mixed $files files to archive
68
-	 * @return object
69
-	 */
70
-	final public function add_files($files)
71
-	{
72
-		$this->files = $files;
73
-		return $this;
74
-	}
75
-
76
-	/**
77
-	 * Returns files to be added to archive file.
78
-	 *
79
-	 * @return mixed
80
-	 */
81
-	final public function get_files()
82
-	{
83
-		return is_array($this->files) ? $this->files : [$this->files];
84
-	}
85
-
86
-	/**
87
-	 * Returns archive file info (zip).
88
-	 *
89
-	 * @param  array $options supported zip command options.
90
-	 * @return string
91
-	 */
92
-	final public function zipinfo(array $options = [])
93
-	{
94
-		$this->command = (new Builder())
95
-			->setPrefix('zipinfo')
96
-			->setOptions($options)
97
-			->setArguments([$this->archive]);
98
-
99
-		$process = (new Subprocess())->subprocess($this->command);
100
-		$stdout = $process['stdout'];
101
-		$stderr = $process['stderr'];
102
-		$retval = $process['error_code'][0];
103
-
104
-		if ($retval != 0)
105
-		{
106
-			throw new \RuntimeException(empty($stderr) ? $stdout : $stderr);
107
-		}
108
-		return $stdout;
109
-	}
110
-
111
-	/**
112
-	 * Create archive file (zip).
113
-	 *
114
-	 * @param  array $options supported zip command options
15
+    /**
16
+     * Archive filename.
17
+     *
18
+     * @var string
19
+     */
20
+    private $archive;
21
+
22
+    /**
23
+     * Files to archive.
24
+     *
25
+     * @var array
26
+     */
27
+    private $files = [];
28
+
29
+    /**
30
+     * Archive command.
31
+     *
32
+     * @var string
33
+     */
34
+    public $command = '';
35
+
36
+    /**
37
+     * Strict error checking.
38
+     *
39
+     * @var boolean
40
+     */
41
+    public $strict = false;
42
+
43
+    /**
44
+     * Constructor.
45
+     *
46
+     * @param  string $archive archive filename
47
+     * @return void
48
+     */
49
+    public function __construct($archive)
50
+    {
51
+        $this->archive = $archive;
52
+    }
53
+
54
+    /**
55
+     * Convert object of class to string.
56
+     *
57
+     * @return string
58
+     */
59
+    public function __toString()
60
+    {
61
+        return (string) $this->command;
62
+    }
63
+
64
+    /**
65
+     * Add files to archive file.
66
+     *
67
+     * @param  mixed $files files to archive
68
+     * @return object
69
+     */
70
+    final public function add_files($files)
71
+    {
72
+        $this->files = $files;
73
+        return $this;
74
+    }
75
+
76
+    /**
77
+     * Returns files to be added to archive file.
78
+     *
79
+     * @return mixed
80
+     */
81
+    final public function get_files()
82
+    {
83
+        return is_array($this->files) ? $this->files : [$this->files];
84
+    }
85
+
86
+    /**
87
+     * Returns archive file info (zip).
88
+     *
89
+     * @param  array $options supported zip command options.
90
+     * @return string
91
+     */
92
+    final public function zipinfo(array $options = [])
93
+    {
94
+        $this->command = (new Builder())
95
+            ->setPrefix('zipinfo')
96
+            ->setOptions($options)
97
+            ->setArguments([$this->archive]);
98
+
99
+        $process = (new Subprocess())->subprocess($this->command);
100
+        $stdout = $process['stdout'];
101
+        $stderr = $process['stderr'];
102
+        $retval = $process['error_code'][0];
103
+
104
+        if ($retval != 0)
105
+        {
106
+            throw new \RuntimeException(empty($stderr) ? $stdout : $stderr);
107
+        }
108
+        return $stdout;
109
+    }
110
+
111
+    /**
112
+     * Create archive file (zip).
113
+     *
114
+     * @param  array $options supported zip command options
115 115
      * @param  bool  $strict  strict error checking
116
-	 * @return object
117
-	 */
118
-	final public function zip(array $options = [], $strict = false)
119
-	{
120
-		$this->command = (new Builder())
121
-			->setPrefix('zip')
122
-			->setOptions($options)
123
-			->setArguments([$this->archive, $this->get_files()]);
124
-		$this->strict = $strict;
125
-		return $this;
126
-	}
127
-
128
-	/**
129
-	 * Extract archive file (zip).
130
-	 *
131
-	 * @param  array $options    supported zip command options
132
-	 * @param  array $arguments  supported zip command arguments
116
+     * @return object
117
+     */
118
+    final public function zip(array $options = [], $strict = false)
119
+    {
120
+        $this->command = (new Builder())
121
+            ->setPrefix('zip')
122
+            ->setOptions($options)
123
+            ->setArguments([$this->archive, $this->get_files()]);
124
+        $this->strict = $strict;
125
+        return $this;
126
+    }
127
+
128
+    /**
129
+     * Extract archive file (zip).
130
+     *
131
+     * @param  array $options    supported zip command options
132
+     * @param  array $arguments  supported zip command arguments
133 133
      * @param  bool  $strict     strict error checking
134
-	 * @return object
135
-	 */
136
-	final public function unzip(array $options = [], array $arguments = [], $strict = true)
137
-	{
138
-		$this->command = (new Builder())
139
-			->setPrefix('unzip')
140
-			->setOptions($options)
141
-			->setArguments(array_merge([$this->archive], $arguments));
142
-		$this->strict = $strict;
143
-		return $this;
144
-	}
145
-
146
-	/**
147
-	 * Create archive file (tar).
148
-	 *
149
-	 * @param  array $options    supported tar command options
150
-	 * @param  array $arguments  supported tar command arguments
134
+     * @return object
135
+     */
136
+    final public function unzip(array $options = [], array $arguments = [], $strict = true)
137
+    {
138
+        $this->command = (new Builder())
139
+            ->setPrefix('unzip')
140
+            ->setOptions($options)
141
+            ->setArguments(array_merge([$this->archive], $arguments));
142
+        $this->strict = $strict;
143
+        return $this;
144
+    }
145
+
146
+    /**
147
+     * Create archive file (tar).
148
+     *
149
+     * @param  array $options    supported tar command options
150
+     * @param  array $arguments  supported tar command arguments
151 151
      * @param  bool  $strict     strict error checking
152
-	 * @return object
153
-	 */
154
-	final public function tar(array $options = [],  array $arguments = [], $strict = true)
155
-	{
156
-		$this->command = (new Builder())
157
-			->setPrefix('tar')
158
-			->setOptions($options)
159
-			->setArguments(array_merge([$this->archive], $arguments, $this->get_files()));
160
-		$this->strict = $strict;
161
-		return $this;
162
-	}
163
-
164
-	/**
165
-	 * Compresses archive file (xz).
166
-	 *
167
-	 * @param  array $options   supported tar command options.
168
-	 * @param  bool  $strict    strict error checking
169
-	 * @return object
170
-	 */
171
-	final public function xz(array $options = [], $strict = true)
172
-	{
173
-		$this->command = (new Builder())
174
-			->setPrefix('xz')
175
-			->setOptions($options)
176
-			->setArguments($this->get_files());
177
-		$this->strict = $strict;
178
-		return $this;
179
-	}
180
-
181
-	/**
182
-	 * Executes archive command..
183
-	 *
184
-	 * @return mixed exit status code or false (no files)
185
-	 */
186
-	final public function run()
187
-	{
188
-		$process = (new Subprocess())->subprocess($this->command);
189
-		$stdout = $process['stdout'];
190
-		$stderr = $process['stderr'];
191
-		$retval = $process['error_code'][0];
192
-
193
-		if (($this->strict === false || $this->strict) && $retval == 0)
194
-		{
195
-			return true;
196
-		}
197
-
198
-		if ($this->strict === false && $retval != 0)
199
-		{
200
-			return $retval;
201
-		}
202
-
203
-		if ($this->strict && $retval != 0)
204
-		{
205
-			throw new \RuntimeException(empty($stderr) ? $stdout : $stderr);
206
-		}
207
-	}
152
+     * @return object
153
+     */
154
+    final public function tar(array $options = [],  array $arguments = [], $strict = true)
155
+    {
156
+        $this->command = (new Builder())
157
+            ->setPrefix('tar')
158
+            ->setOptions($options)
159
+            ->setArguments(array_merge([$this->archive], $arguments, $this->get_files()));
160
+        $this->strict = $strict;
161
+        return $this;
162
+    }
163
+
164
+    /**
165
+     * Compresses archive file (xz).
166
+     *
167
+     * @param  array $options   supported tar command options.
168
+     * @param  bool  $strict    strict error checking
169
+     * @return object
170
+     */
171
+    final public function xz(array $options = [], $strict = true)
172
+    {
173
+        $this->command = (new Builder())
174
+            ->setPrefix('xz')
175
+            ->setOptions($options)
176
+            ->setArguments($this->get_files());
177
+        $this->strict = $strict;
178
+        return $this;
179
+    }
180
+
181
+    /**
182
+     * Executes archive command..
183
+     *
184
+     * @return mixed exit status code or false (no files)
185
+     */
186
+    final public function run()
187
+    {
188
+        $process = (new Subprocess())->subprocess($this->command);
189
+        $stdout = $process['stdout'];
190
+        $stderr = $process['stderr'];
191
+        $retval = $process['error_code'][0];
192
+
193
+        if (($this->strict === false || $this->strict) && $retval == 0)
194
+        {
195
+            return true;
196
+        }
197
+
198
+        if ($this->strict === false && $retval != 0)
199
+        {
200
+            return $retval;
201
+        }
202
+
203
+        if ($this->strict && $retval != 0)
204
+        {
205
+            throw new \RuntimeException(empty($stderr) ? $stdout : $stderr);
206
+        }
207
+    }
208 208
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@
 block discarded – undo
151 151
      * @param  bool  $strict     strict error checking
152 152
 	 * @return object
153 153
 	 */
154
-	final public function tar(array $options = [],  array $arguments = [], $strict = true)
154
+	final public function tar(array $options = [], array $arguments = [], $strict = true)
155 155
 	{
156 156
 		$this->command = (new Builder())
157 157
 			->setPrefix('tar')
Please login to merge, or discard this patch.
lib/Subprocess.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -62,30 +62,30 @@  discard block
 block discarded – undo
62 62
         $process->setTimeout(3600);
63 63
         $process->setIdleTimeout(3600);
64 64
 
65
-		if ($stream == 1)
66
-		{
67
-			return $this->stream_to_file($process, $stdoutfile, $stderrfile);
68
-		}
69
-
70
-		if ($stream == 2)
71
-		{
72
-			return $this->stream_to_stdout($process);
73
-		}
74
-
75
-		if ($stream == 3)
76
-		{
77
-			return $this->stream_to_both($process, $stdoutfile, $stderrfile);
78
-		}
79
-
80
-		if ($stream == 4)
81
-		{
82
-			return $this->stream_stdout_wait($process, $fail_on_error);
83
-		}
84
-
85
-		if ($stream == 5)
86
-		{
87
-			return $this->stream_stdout_tty($process);
88
-		}
65
+        if ($stream == 1)
66
+        {
67
+            return $this->stream_to_file($process, $stdoutfile, $stderrfile);
68
+        }
69
+
70
+        if ($stream == 2)
71
+        {
72
+            return $this->stream_to_stdout($process);
73
+        }
74
+
75
+        if ($stream == 3)
76
+        {
77
+            return $this->stream_to_both($process, $stdoutfile, $stderrfile);
78
+        }
79
+
80
+        if ($stream == 4)
81
+        {
82
+            return $this->stream_stdout_wait($process, $fail_on_error);
83
+        }
84
+
85
+        if ($stream == 5)
86
+        {
87
+            return $this->stream_stdout_tty($process);
88
+        }
89 89
     }
90 90
 
91 91
     /**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                     file_put_contents($GLOBALS['stderrfile'], $buffer, FILE_APPEND | LOCK_EX);
115 115
                 }
116 116
 
117
-				if ($GLOBALS['stderrfile'] === null)
117
+                if ($GLOBALS['stderrfile'] === null)
118 118
                 {
119 119
                     file_put_contents($GLOBALS['stdoutfile'], $buffer, FILE_APPEND | LOCK_EX);
120 120
                 }
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
                     file_put_contents($GLOBALS['stderrfile'], $buffer, FILE_APPEND | LOCK_EX);
176 176
                 }
177 177
 
178
-				if ($GLOBALS['stderrfile'] === null)
178
+                if ($GLOBALS['stderrfile'] === null)
179 179
                 {
180 180
                     file_put_contents($GLOBALS['stdoutfile'], $buffer, FILE_APPEND | LOCK_EX);
181 181
                 }
182 182
                 fwrite(STDERR, $buffer);
183 183
             }
184 184
 
185
-			if (Process::ERR !== $type)
185
+            if (Process::ERR !== $type)
186 186
             {
187 187
                 file_put_contents($GLOBALS['stdoutfile'], $buffer, FILE_APPEND | LOCK_EX);
188 188
                 fwrite(STDOUT, $buffer);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $GLOBALS['stdoutfile'] = $stdoutfile;
107 107
         $GLOBALS['stderrfile'] = $stderrfile;
108 108
 
109
-        $process->run(function ($type, $buffer) {
109
+        $process->run(function($type, $buffer) {
110 110
             if (Process::ERR === $type)
111 111
             {
112 112
                 if ($GLOBALS['stderrfile'] !== null)
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     final protected function stream_to_stdout(Process $process)
137 137
     {
138
-        $process->run(function ($type, $buffer) {
138
+        $process->run(function($type, $buffer) {
139 139
             if (Process::ERR === $type)
140 140
             {
141 141
                 fwrite(STDERR, $buffer);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         $GLOBALS['stdoutfile'] = $stdoutfile;
168 168
         $GLOBALS['stderrfile'] = $stderrfile;
169 169
 
170
-        $process->run(function ($type, $buffer) {
170
+        $process->run(function($type, $buffer) {
171 171
             if (Process::ERR === $type)
172 172
             {
173 173
                 if ($GLOBALS['stderrfile'] !== null)
Please login to merge, or discard this patch.