GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( cf0279...fd4b07 )
by Steeven
03:11 queued 10s
created
src/System.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
         $string = trim(shell_exec($cmd));
256 256
 
257 257
         if (preg_match_all('/([0-9a-f]{2}:){5}\w\w/i', $string, $matches)) {
258
-            if (isset($matches[ 0 ])) {
259
-                return reset($matches[ 0 ]); // get first mac address
258
+            if (isset($matches[0])) {
259
+                return reset($matches[0]); // get first mac address
260 260
             }
261 261
         } else {
262 262
             return implode(':', str_split(substr(md5('none'), 0, 12), 2));
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     {
279 279
         $rs = sys_getloadavg();
280 280
         $interval = $interval >= 1 && 3 <= $interval ? $interval : 1;
281
-        $load = $rs[ $interval ];
281
+        $load = $rs[$interval];
282 282
 
283 283
         return round(($load * 100) / $this->getCpuCores(), 2);
284 284
     }
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         if (is_file('/proc/cpuinfo')) {
299 299
             $cpuinfo = file_get_contents('/proc/cpuinfo');
300 300
             preg_match_all('/^processor/m', $cpuinfo, $matches);
301
-            $numCpus = count($matches[ 0 ]);
301
+            $numCpus = count($matches[0]);
302 302
         } else {
303 303
             if ('WIN' == strtoupper(substr(PHP_OS, 0, 3))) {
304 304
                 $process = @popen('wmic cpu get NumberOfCores', 'rb');
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                     $output = stream_get_contents($process);
314 314
                     preg_match('/hw.ncpu: (\d+)/', $output, $matches);
315 315
                     if ($matches) {
316
-                        $numCpus = intval($matches[ 1 ][ 0 ]);
316
+                        $numCpus = intval($matches[1][0]);
317 317
                     }
318 318
                     pclose($process);
319 319
                 }
Please login to merge, or discard this patch.
src/autoload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  * @param $className
17 17
  */
18 18
 spl_autoload_register(
19
-    function ($className) {
19
+    function($className) {
20 20
         if ($className === 'O2System\Filesystem') {
21 21
             require __DIR__ . DIRECTORY_SEPARATOR . 'File.php';
22 22
         } elseif (strpos($className, 'O2System\Filesystem\\') === false) {
Please login to merge, or discard this patch.
src/File.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     public function show()
203 203
     {
204 204
         if ($mime = $this->getMime()) {
205
-            $mime = is_array($mime) ? $mime[ 0 ] : $mime;
205
+            $mime = is_array($mime) ? $mime[0] : $mime;
206 206
         } elseif (is_file($this->getRealPath())) {
207 207
             $mime = 'application/octet-stream';
208 208
         }
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 
226 226
         $ETag = '"' . md5($filename) . '"';
227 227
 
228
-        if ( ! empty($_SERVER[ 'HTTP_IF_NONE_MATCH' ])
229
-            && $_SERVER[ 'HTTP_IF_NONE_MATCH' ] == $ETag
228
+        if ( ! empty($_SERVER['HTTP_IF_NONE_MATCH'])
229
+            && $_SERVER['HTTP_IF_NONE_MATCH'] == $ETag
230 230
         ) {
231 231
             header('HTTP/1.1 304 Not Modified');
232 232
             header('Content-Length: ' . $fileSize);
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
         $mimes = $this->getMimes();
269 269
         $ext = strtolower($this->getExtension());
270 270
 
271
-        if (isset($mimes[ $ext ])) {
272
-            return $mimes[ $ext ];
271
+        if (isset($mimes[$ext])) {
272
+            return $mimes[$ext];
273 273
         }
274 274
 
275 275
         return false;
Please login to merge, or discard this patch.
src/Files/CsvFile.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
         $result = [];
59 59
 
60 60
         if (false !== ($handle = fopen($filePath, 'r'))) {
61
-            while (false !== ($data = fgetcsv($handle, $options[ 'length' ], $options[ 'delimiter' ]))) {
61
+            while (false !== ($data = fgetcsv($handle, $options['length'], $options['delimiter']))) {
62 62
                 $result[] = fgetcsv($handle);
63 63
             }
64 64
         }
Please login to merge, or discard this patch.
src/Files/IniFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             $filePath,
42 42
             (empty($options)
43 43
                 ? true
44
-                : $options[ 'sections' ])
44
+                : $options['sections'])
45 45
         );
46 46
 
47 47
         $this->merge($items);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         $sections = (empty($options)
69 69
             ? true
70
-            : $options[ 'sections' ]);
70
+            : $options['sections']);
71 71
 
72 72
         $content = null;
73 73
 
Please login to merge, or discard this patch.
src/Handlers/Ftp.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
         $this->setConfig($config);
73 73
 
74 74
         // Prep the port
75
-        $this->config[ 'port' ] = empty($this->config[ 'port' ]) ? 21 : (int)$this->config[ 'port' ];
75
+        $this->config['port'] = empty($this->config['port']) ? 21 : (int)$this->config['port'];
76 76
 
77 77
         // Prep the hostname
78
-        $this->config[ 'hostname' ] = preg_replace('|.+?://|', '', $this->config[ 'hostname' ]);
78
+        $this->config['hostname'] = preg_replace('|.+?://|', '', $this->config['hostname']);
79 79
 
80 80
         language()
81 81
             ->addFilePath(str_replace('Handlers', '', __DIR__) . DIRECTORY_SEPARATOR)
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function connect()
96 96
     {
97
-        if (false === ($this->handle = @ftp_connect($this->config[ 'hostname' ], $this->config[ 'port' ]))) {
97
+        if (false === ($this->handle = @ftp_connect($this->config['hostname'], $this->config['port']))) {
98 98
             if ($this->debugMode === true) {
99 99
                 throw new RuntimeException('FTP_E_UNABLE_TO_CONNECT');
100 100
             }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             return false;
105 105
         }
106 106
 
107
-        if (false !== (@ftp_login($this->handle, $this->config[ 'username' ], $this->config[ 'password' ]))) {
107
+        if (false !== (@ftp_login($this->handle, $this->config['username'], $this->config['password']))) {
108 108
             if ($this->debugMode === true) {
109 109
                 throw new RuntimeException('FTP_E_UNABLE_TO_LOGIN');
110 110
             }
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
             for ($i = 0, $c = count($list); $i < $c; $i++) {
360 360
                 // If we can't delete the item it's probaly a directory,
361 361
                 // so we'll recursively call delete_dir()
362
-                if ( ! preg_match('#/\.\.?$#', $list[ $i ]) && ! @ftp_delete($this->handle, $list[ $i ])) {
363
-                    $this->deleteDir($list[ $i ]);
362
+                if ( ! preg_match('#/\.\.?$#', $list[$i]) && ! @ftp_delete($this->handle, $list[$i])) {
363
+                    $this->deleteDir($list[$i]);
364 364
                 }
365 365
             }
366 366
         }
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
 
434 434
             // Recursively read the local directory
435 435
             while (false !== ($file = readdir($fp))) {
436
-                if (is_dir($localPath . $file) && $file[ 0 ] !== '.') {
436
+                if (is_dir($localPath . $file) && $file[0] !== '.') {
437 437
                     $this->mirror($localPath . $file . '/', $remotePath . $file . '/');
438
-                } elseif ($file[ 0 ] !== '.') {
438
+                } elseif ($file[0] !== '.') {
439 439
                     // Get the file extension so we can se the upload type
440 440
                     $ext = $this->getExtension($file);
441 441
                     $mode = $this->getTransferMode($ext);
Please login to merge, or discard this patch.
src/Handlers/Downloader.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             }
192 192
 
193 193
             $this->filesize = strlen($this->filedata);
194
-            $this->filemime = mime_content_type($this->fileinfo[ 'filename' ]);
194
+            $this->filemime = mime_content_type($this->fileinfo['filename']);
195 195
             $this->lastModified = time();
196 196
 
197 197
         } else {
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
         }
202 202
 
203 203
         // Range
204
-        if (isset($_SERVER[ 'HTTP_RANGE' ]) || isset($HTTP_SERVER_VARS[ 'HTTP_RANGE' ])) {
204
+        if (isset($_SERVER['HTTP_RANGE']) || isset($HTTP_SERVER_VARS['HTTP_RANGE'])) {
205 205
             $this->partialRequest = true;
206
-            $http_range = isset($_SERVER[ 'HTTP_RANGE' ]) ? $_SERVER[ 'HTTP_RANGE' ] : $HTTP_SERVER_VARS[ 'HTTP_RANGE' ];
206
+            $http_range = isset($_SERVER['HTTP_RANGE']) ? $_SERVER['HTTP_RANGE'] : $HTTP_SERVER_VARS['HTTP_RANGE'];
207 207
             if (stripos($http_range, 'bytes') === false) {
208 208
                 output()
209 209
                     ->withStatus(416, 'Requested Range Not Satisfiable')
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 
213 213
             $range = substr($http_range, strlen('bytes='));
214 214
             $range = explode('-', $range, 3);
215
-            $this->seekStart = ($range[ 0 ] > 0 && $range[ 0 ] < $this->filesize - 1) ? $range[ 0 ] : 0;
216
-            $this->seekEnd = ($range[ 1 ] > 0 && $range[ 1 ] < $this->filesize && $range[ 1 ] > $this->seekStart) ? $range[ 1 ] : $this->filesize - 1;
215
+            $this->seekStart = ($range[0] > 0 && $range[0] < $this->filesize - 1) ? $range[0] : 0;
216
+            $this->seekEnd = ($range[1] > 0 && $range[1] < $this->filesize && $range[1] > $this->seekStart) ? $range[1] : $this->filesize - 1;
217 217
             $this->seekFileSize = $this->seekEnd - $this->seekStart + 1;
218 218
         } else {
219 219
             $this->partialRequest = false;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     public function download($filename = null)
249 249
     {
250
-        $filename = isset($filename) ? $filename : $this->fileinfo[ 'basename' ];
250
+        $filename = isset($filename) ? $filename : $this->fileinfo['basename'];
251 251
 
252 252
         if ($this->partialRequest) {
253 253
             if ($this->resumeable) {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         // Work On Download Speed Limit
279 279
         if ($this->speedLimit) {
280 280
             // how many buffers ticks per second
281
-            $bufferTicks = 10;    //10
281
+            $bufferTicks = 10; //10
282 282
             // how long one buffering tick takes by micro second
283 283
             $bufferMicroTime = 150; // 100
284 284
             // Calculate sleep micro time after each tick
@@ -309,17 +309,17 @@  discard block
 block discarded – undo
309 309
                 if ($downloadFileBytes > $this->bufferSize) {
310 310
                     // send buffer size
311 311
                     echo fread($this->filedata, $this->bufferSize); // this also will seek to after last read byte
312
-                    $downloaded += $this->bufferSize;    // updated downloaded
313
-                    $downloadFileBytes -= $this->bufferSize;    // update remaining bytes
312
+                    $downloaded += $this->bufferSize; // updated downloaded
313
+                    $downloadFileBytes -= $this->bufferSize; // update remaining bytes
314 314
                 } else {
315 315
                     // send required size
316 316
                     // this will happens when we reaches the end of the file normally we wll download remaining bytes
317
-                    echo fread($this->filedata, $downloadFileBytes);    // this also will seek to last reat
317
+                    echo fread($this->filedata, $downloadFileBytes); // this also will seek to last reat
318 318
 
319
-                    $downloaded += $downloadFileBytes;    // Add to downloaded
319
+                    $downloaded += $downloadFileBytes; // Add to downloaded
320 320
 
321 321
 
322
-                    $downloadFileBytes = 0;    // Here last bytes have been written
322
+                    $downloadFileBytes = 0; // Here last bytes have been written
323 323
                 }
324 324
                 // send to buffer
325 325
                 flush();
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
      */
383 383
     public function resumeable($status = true)
384 384
     {
385
-        $this->partialRequest = $this->resumeable = ( bool )$status;
385
+        $this->partialRequest = $this->resumeable = (bool)$status;
386 386
 
387 387
         return $this;
388 388
     }
Please login to merge, or discard this patch.
src/Handlers/Uploader.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -107,34 +107,34 @@  discard block
 block discarded – undo
107 107
             throw new BadDependencyCallException('UPLOADER_E_FINFO_EXTENSION');
108 108
         }
109 109
 
110
-        if (isset($config[ 'path' ])) {
111
-            $config[ 'path' ] = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $config[ 'path' ]);
110
+        if (isset($config['path'])) {
111
+            $config['path'] = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $config['path']);
112 112
 
113
-            if (is_dir($config[ 'path' ])) {
114
-                $this->path = $config[ 'path' ];
113
+            if (is_dir($config['path'])) {
114
+                $this->path = $config['path'];
115 115
             } elseif (defined('PATH_STORAGE')) {
116
-                if (is_dir($config[ 'path' ])) {
117
-                    $this->path = $config[ 'path' ];
116
+                if (is_dir($config['path'])) {
117
+                    $this->path = $config['path'];
118 118
                 } else {
119
-                    $this->path = PATH_STORAGE . str_replace(PATH_STORAGE, '', $config[ 'path' ]);
119
+                    $this->path = PATH_STORAGE . str_replace(PATH_STORAGE, '', $config['path']);
120 120
                 }
121 121
             } else {
122
-                $this->path = dirname($_SERVER[ 'SCRIPT_FILENAME' ]) . DIRECTORY_SEPARATOR . $config[ 'path' ];
122
+                $this->path = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . $config['path'];
123 123
             }
124 124
         } elseif (defined('PATH_STORAGE')) {
125 125
             $this->path = PATH_STORAGE;
126 126
         } else {
127
-            $this->path = dirname($_SERVER[ 'SCRIPT_FILENAME' ]) . DIRECTORY_SEPARATOR . 'upload';
127
+            $this->path = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . 'upload';
128 128
         }
129 129
 
130 130
         $this->path = rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
131 131
 
132
-        if (isset($config[ 'allowedMimes' ])) {
133
-            $this->setAllowedMimes($config[ 'allowedMimes' ]);
132
+        if (isset($config['allowedMimes'])) {
133
+            $this->setAllowedMimes($config['allowedMimes']);
134 134
         }
135 135
 
136
-        if (isset($config[ 'allowedExtensions' ])) {
137
-            $this->setAllowedExtensions($config[ 'allowedExtensions' ]);
136
+        if (isset($config['allowedExtensions'])) {
137
+            $this->setAllowedExtensions($config['allowedExtensions']);
138 138
         }
139 139
 
140 140
         $this->uploadedFiles = new ArrayIterator();
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 $this->path = PATH_STORAGE . str_replace(PATH_STORAGE, '', $path);
207 207
             }
208 208
         } else {
209
-            $this->path = dirname($_SERVER[ 'SCRIPT_FILENAME' ]) . DIRECTORY_SEPARATOR . $path;
209
+            $this->path = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . $path;
210 210
         }
211 211
     }
212 212
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                 break;
240 240
         }
241 241
 
242
-        $this->allowedFileSize[ 'min' ] = (int)$fileSize;
242
+        $this->allowedFileSize['min'] = (int)$fileSize;
243 243
 
244 244
         return $this;
245 245
     }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                 break;
274 274
         }
275 275
 
276
-        $this->allowedFileSize[ 'max' ] = (int)$fileSize;
276
+        $this->allowedFileSize['max'] = (int)$fileSize;
277 277
 
278 278
         return $this;
279 279
     }
@@ -429,21 +429,21 @@  discard block
 block discarded – undo
429 429
         }
430 430
 
431 431
         /* Validate min size */
432
-        if ($this->allowedFileSize[ 'min' ] > 0) {
433
-            if ($file->getSize() < $this->allowedFileSize[ 'min' ]) {
432
+        if ($this->allowedFileSize['min'] > 0) {
433
+            if ($file->getSize() < $this->allowedFileSize['min']) {
434 434
                 $this->errors[] = language()->getLine(
435 435
                     'UPLOADER_E_ALLOWED_MIN_FILESIZE',
436
-                    [$this->allowedFileSize[ 'min' ], $file->getSize()]
436
+                    [$this->allowedFileSize['min'], $file->getSize()]
437 437
                 );
438 438
             }
439 439
         }
440 440
 
441 441
         /* Validate max size */
442
-        if ($this->allowedFileSize[ 'max' ] > 0) {
443
-            if ($file->getSize() > $this->allowedFileSize[ 'max' ]) {
442
+        if ($this->allowedFileSize['max'] > 0) {
443
+            if ($file->getSize() > $this->allowedFileSize['max']) {
444 444
                 $this->errors[] = language()->getLine(
445 445
                     'UPLOADER_E_ALLOWED_MAX_FILESIZE',
446
-                    [$this->allowedFileSize[ 'max' ], $file->getSize()]
446
+                    [$this->allowedFileSize['max'], $file->getSize()]
447 447
                 );
448 448
             }
449 449
         }
Please login to merge, or discard this patch.