Passed
Push — master ( 5e9142...fc9574 )
by Goffy
03:35
created
preloads/autoloader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,12 +4,12 @@  discard block
 block discarded – undo
4 4
  * @see http://www.php-fig.org/psr/psr-4/examples/
5 5
  */
6 6
 spl_autoload_register(
7
-    static function ($class) {
7
+    static function($class) {
8 8
         // project-specific namespace prefix
9
-        $prefix = 'XoopsModules\\' . \ucfirst(\basename(\dirname(__DIR__)));
9
+        $prefix = 'XoopsModules\\'.\ucfirst(\basename(\dirname(__DIR__)));
10 10
 
11 11
         // base directory for the namespace prefix
12
-        $baseDir = __DIR__ . '/../class/';
12
+        $baseDir = __DIR__.'/../class/';
13 13
 
14 14
         // does the class use the namespace prefix?
15 15
         $len = mb_strlen($prefix);
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         // replace the namespace prefix with the base directory, replace namespace
25 25
         // separators with directory separators in the relative class name, append
26 26
         // with .php
27
-        $file = $baseDir . \str_replace('\\', '/', $relativeClass) . '.php';
27
+        $file = $baseDir.\str_replace('\\', '/', $relativeClass).'.php';
28 28
 
29 29
         // if the file exists, require it
30 30
         if (\file_exists($file)) {
Please login to merge, or discard this patch.
class/Repositories.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@
 block discarded – undo
164 164
         $ret['readme']      = $this->getVar('repo_readme');
165 165
         $ret['prerelease']  = $this->getVar('repo_prerelease');
166 166
         $ret['release']     = $this->getVar('repo_release');
167
-        $ret['approved']    = (int)$this->getVar('repo_approved') > 0 ? \_YES : \_NO;
167
+        $ret['approved']    = (int) $this->getVar('repo_approved') > 0 ? \_YES : \_NO;
168 168
         $status             = $this->getVar('repo_status');
169 169
         $ret['status']      = $status;
170 170
         switch ($status) {
Please login to merge, or discard this patch.
class/Github/Storages/FileCache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             throw new MissingDirectoryException("Directory '$tempDir' is missing.");
28 28
         }
29 29
 
30
-        $dir = $tempDir . DIRECTORY_SEPARATOR . 'milo.github-api';
30
+        $dir = $tempDir.DIRECTORY_SEPARATOR.'milo.github-api';
31 31
 
32 32
         if (!is_dir($dir)) {
33 33
             set_error_handler(function($severity, $message, $file, $line) use ($dir, & $valid) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     private function filePath($key)
93 93
     {
94
-        return $this->dir . DIRECTORY_SEPARATOR . sha1($key) . '.php';
94
+        return $this->dir.DIRECTORY_SEPARATOR.sha1($key).'.php';
95 95
     }
96 96
 
97 97
 }
Please login to merge, or discard this patch.
class/Github/GithubClient.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     public function testApi1($url) {
83 83
         $api = new Github\Api;
84
-        $response = $api->get(static::BASE_URL . $url);
84
+        $response = $api->get(static::BASE_URL.$url);
85 85
         $data = $api->decode($response);
86 86
         
87 87
         return $data;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         $token = new Github\OAuth\Token('{myKey}', 'bearer', ['repo', 'user', 'public_repo']);
94 94
         $api->setToken($token);
95
-        $response = $api->get(static::BASE_URL . $url);
95
+        $response = $api->get(static::BASE_URL.$url);
96 96
 
97 97
         $data = $api->decode($response);
98 98
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getUserRepositories($username, $per_page = 100, $page = 1)
119 119
     {
120
-        $url = static::BASE_URL . 'users/' . \rawurlencode($username) . '/repos?per_page=' . $per_page . '&page=' . $page;
120
+        $url = static::BASE_URL.'users/'.\rawurlencode($username).'/repos?per_page='.$per_page.'&page='.$page;
121 121
 
122 122
         return $this->_get($url);
123 123
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function getOrgRepositories($org, $per_page = 100, $page = 1)
134 134
     {
135
-        $url = static::BASE_URL . 'orgs/' . \rawurlencode($org) . '/repos?per_page=' . $per_page . '&page=' . $page;
135
+        $url = static::BASE_URL.'orgs/'.\rawurlencode($org).'/repos?per_page='.$per_page.'&page='.$page;
136 136
 
137 137
         return $this->_get($url);
138 138
     }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function getReadme($username, $repository)
148 148
     {
149
-        $url = static::BASE_URL . 'repos/' . \rawurlencode($username) . '/' . \rawurlencode($repository) . '/readme';
149
+        $url = static::BASE_URL.'repos/'.\rawurlencode($username).'/'.\rawurlencode($repository).'/readme';
150 150
 
151 151
         return $this->_get($url, true);
152 152
     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function getReleases($username, $repository)
162 162
     {
163
-        $url = static::BASE_URL . 'repos/' . $username . '/' . $repository . '/releases';
163
+        $url = static::BASE_URL.'repos/'.$username.'/'.$repository.'/releases';
164 164
 
165 165
         return $this->_get($url, true);
166 166
     }
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
     public function getLatestRelease($username, $repository, $prerelease = false)
177 177
     {
178 178
         if ($prerelease) {
179
-            $url = static::BASE_URL . 'repos/' . $username . '/' . $repository . '/releases';
179
+            $url = static::BASE_URL.'repos/'.$username.'/'.$repository.'/releases';
180 180
         } else {
181
-            $url = static::BASE_URL . 'repos/' . $username . '/' . $repository . '/releases/latest';
181
+            $url = static::BASE_URL.'repos/'.$username.'/'.$repository.'/releases/latest';
182 182
         }
183 183
         $result = $this->_get($url);
184 184
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function getRepositoryContent($username, $repository)
204 204
     {
205
-        $url = static::BASE_URL . 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents';
205
+        $url = static::BASE_URL.'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents';
206 206
 
207 207
         return $this->_get($url);
208 208
     }
@@ -235,14 +235,14 @@  discard block
 block discarded – undo
235 235
             } else {
236 236
                 $error = true;
237 237
                 $errMsg = $response->getContent();
238
-                $logsHandler->updateTableLogs(Constants::LOG_TYPE_ERROR, $errMsg, 'ERROR ' . $code);
238
+                $logsHandler->updateTableLogs(Constants::LOG_TYPE_ERROR, $errMsg, 'ERROR '.$code);
239 239
             }
240 240
         }
241 241
         if ($error) {
242 242
             //catch common errors
243 243
             switch ($code) {
244 244
                 case 401:
245
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_401 . '"');
245
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_401.'"');
246 246
                     break;
247 247
                 case 403:
248 248
                     /*
@@ -250,21 +250,21 @@  discard block
 block discarded – undo
250 250
                         $GLOBALS['xoopsTpl']->assign('apiexceed', true);
251 251
                     }
252 252
                     */
253
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_403 . '"');
253
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_403.'"');
254 254
                     break;
255 255
                 case 404:
256
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_404 . '"');
256
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_404.'"');
257 257
                     break;
258 258
                 case 405:
259
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_405 . '"');
259
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_405.'"');
260 260
                     break;
261 261
                 case 0:
262 262
                 default:
263
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API . $errMsg . '"');
263
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API.$errMsg.'"');
264 264
                     break;
265 265
             }
266 266
         }
267
-        $data = (array)$api->decode($response);
267
+        $data = (array) $api->decode($response);
268 268
 
269 269
         return $data;
270 270
     }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         $setting = $settingsHandler->getPrimarySetting();
342 342
 
343 343
         if (0 == \count($setting)) {
344
-            \redirect_header(\XOOPS_URL . '/index.php', 3, \_AM_WGGITHUB_THEREARENT_SETTINGS);
344
+            \redirect_header(\XOOPS_URL.'/index.php', 3, \_AM_WGGITHUB_THEREARENT_SETTINGS);
345 345
         }
346 346
         //$this->userAuth = $setting['user'];
347 347
         $this->tokenAuth = $setting['token'];
Please login to merge, or discard this patch.
class/Github/Http/StreamClient.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
         $options = [
48 48
             'http' => [
49 49
                 'method' => $request->getMethod(),
50
-                'header' => implode("\r\n", $headerStr) . "\r\n",
51
-                'follow_location' => 0,  # Github sets the Location header for 201 code too and redirection is not required for us
50
+                'header' => implode("\r\n", $headerStr)."\r\n",
51
+                'follow_location' => 0, # Github sets the Location header for 201 code too and redirection is not required for us
52 52
                 'protocol_version' => 1.1,
53 53
                 'ignore_errors' => TRUE,
54 54
             ],
55 55
             'ssl' => [
56 56
                 'verify_peer' => TRUE,
57
-                'cafile' => realpath(__DIR__ . '/../../ca-chain.crt'),
58
-                'disable_compression' => TRUE,  # Effective since PHP 5.4.13
57
+                'cafile' => realpath(__DIR__.'/../../ca-chain.crt'),
58
+                'disable_compression' => TRUE, # Effective since PHP 5.4.13
59 59
             ],
60 60
         ];
61 61
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $headers = [];
105 105
         foreach ($http_response_header as $header) {
106 106
             if (in_array(substr($header, 0, 1), [' ', "\t"], TRUE)) {
107
-                $headers[$last] .= ' ' . trim($header);  # RFC2616, 2.2
107
+                $headers[$last] .= ' '.trim($header); # RFC2616, 2.2
108 108
             } else {
109 109
                 list($name, $value) = explode(':', $header, 2) + [NULL, NULL];
110 110
                 $headers[$last = trim($name)] = trim($value);
Please login to merge, or discard this patch.
class/Github/Http/CurlClient.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             CURLOPT_CONNECTTIMEOUT => 10,
59 59
             CURLOPT_SSL_VERIFYHOST => 2,
60 60
             CURLOPT_SSL_VERIFYPEER => 1,
61
-            CURLOPT_CAINFO => realpath(__DIR__ . '/../ca-chain.crt'),
61
+            CURLOPT_CAINFO => realpath(__DIR__.'/../ca-chain.crt'),
62 62
         ];
63 63
 
64 64
         $hardOptions = [
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                     $responseHeaders = [];
79 79
 
80 80
                 } elseif (in_array(substr($line, 0, 1), [' ', "\t"], TRUE)) {
81
-                    $responseHeaders[$last] .= ' ' . trim($line);  # RFC2616, 2.2
81
+                    $responseHeaders[$last] .= ' '.trim($line); # RFC2616, 2.2
82 82
 
83 83
                 } elseif ($line !== "\r\n") {
84 84
                     list($name, $value) = explode(':', $line, 2);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         $result = curl_setopt_array($this->curl, $hardOptions + ($this->options ?: []) + $softOptions);
104 104
         if ($result === FALSE) {
105
-            throw new BadResponseException('Setting cURL options failed: ' . curl_error($this->curl), curl_errno($this->curl));
105
+            throw new BadResponseException('Setting cURL options failed: '.curl_error($this->curl), curl_errno($this->curl));
106 106
         }
107 107
 
108 108
         $content = curl_exec($this->curl);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
         $code = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);
114 114
         if ($code === FALSE) {
115
-            throw new BadResponseException('HTTP status code is missing:' . curl_error($this->curl), curl_errno($this->curl));
115
+            throw new BadResponseException('HTTP status code is missing:'.curl_error($this->curl), curl_errno($this->curl));
116 116
         }
117 117
 
118 118
         return new Response($code, $responseHeaders, $content);
Please login to merge, or discard this patch.
class/Github/Paginator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
      */
149 149
     public static function parseLink($link, $rel)
150 150
     {
151
-        if (!preg_match('(<([^>]+)>;\s*rel="' . preg_quote($rel) . '")', $link, $match)) {
151
+        if (!preg_match('(<([^>]+)>;\s*rel="'.preg_quote($rel).'")', $link, $match)) {
152 152
             return NULL;
153 153
         }
154 154
 
Please login to merge, or discard this patch.
class/Github/Sanity.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function & __get($name)
15 15
     {
16
-        throw new LogicException('Cannot read an undeclared property ' . get_class($this) . "::\$$name.");
16
+        throw new LogicException('Cannot read an undeclared property '.get_class($this)."::\$$name.");
17 17
     }
18 18
 
19 19
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function __set($name, $value)
24 24
     {
25
-        throw new LogicException('Cannot write to an undeclared property ' . get_class($this) . "::\$$name.");
25
+        throw new LogicException('Cannot write to an undeclared property '.get_class($this)."::\$$name.");
26 26
     }
27 27
 
28 28
 }
Please login to merge, or discard this patch.
class/Github/Api.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             $urlPath = $this->expandUriTemplate($urlPath, $parameters, $this->defaultParameters);
255 255
         }
256 256
 
257
-        $url = rtrim($baseUrl, '/') . '/' . ltrim($urlPath, '/');
257
+        $url = rtrim($baseUrl, '/').'/'.ltrim($urlPath, '/');
258 258
 
259 259
         if ($content !== NULL && (is_array($content) || is_object($content))) {
260 260
             $headers['Content-Type'] = 'application/json; charset=utf-8';
@@ -394,13 +394,13 @@  discard block
 block discarded – undo
394 394
             }
395 395
             $parameter = $parameters[$m[2]];
396 396
             unset($parameters[$m[2]]);
397
-            return $m[1] . rawurlencode($parameter);
397
+            return $m[1].rawurlencode($parameter);
398 398
         }, $url);
399 399
 
400 400
         $url = rtrim($url, '/');
401 401
 
402 402
         if (count($parameters)) {
403
-            $url .= '?' . http_build_query($parameters);
403
+            $url .= '?'.http_build_query($parameters);
404 404
         }
405 405
 
406 406
         return $url;
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
         $parameters += $defaultParameters;
422 422
 
423 423
         static $operatorFlags = [
424
-            ''  => ['prefix' => '',  'separator' => ',', 'named' => FALSE, 'ifEmpty' => '',  'reserved' => FALSE],
425
-            '+' => ['prefix' => '',  'separator' => ',', 'named' => FALSE, 'ifEmpty' => '',  'reserved' => TRUE],
426
-            '#' => ['prefix' => '#', 'separator' => ',', 'named' => FALSE, 'ifEmpty' => '',  'reserved' => TRUE],
427
-            '.' => ['prefix' => '.', 'separator' => '.', 'named' => FALSE, 'ifEmpty' => '',  'reserved' => FALSE],
428
-            '/' => ['prefix' => '/', 'separator' => '/', 'named' => FALSE, 'ifEmpty' => '',  'reserved' => FALSE],
429
-            ';' => ['prefix' => ';', 'separator' => ';', 'named' => TRUE,  'ifEmpty' => '',  'reserved' => FALSE],
430
-            '?' => ['prefix' => '?', 'separator' => '&', 'named' => TRUE,  'ifEmpty' => '=', 'reserved' => FALSE],
431
-            '&' => ['prefix' => '&', 'separator' => '&', 'named' => TRUE,  'ifEmpty' => '=', 'reserved' => FALSE],
424
+            ''  => ['prefix' => '', 'separator' => ',', 'named' => FALSE, 'ifEmpty' => '', 'reserved' => FALSE],
425
+            '+' => ['prefix' => '', 'separator' => ',', 'named' => FALSE, 'ifEmpty' => '', 'reserved' => TRUE],
426
+            '#' => ['prefix' => '#', 'separator' => ',', 'named' => FALSE, 'ifEmpty' => '', 'reserved' => TRUE],
427
+            '.' => ['prefix' => '.', 'separator' => '.', 'named' => FALSE, 'ifEmpty' => '', 'reserved' => FALSE],
428
+            '/' => ['prefix' => '/', 'separator' => '/', 'named' => FALSE, 'ifEmpty' => '', 'reserved' => FALSE],
429
+            ';' => ['prefix' => ';', 'separator' => ';', 'named' => TRUE, 'ifEmpty' => '', 'reserved' => FALSE],
430
+            '?' => ['prefix' => '?', 'separator' => '&', 'named' => TRUE, 'ifEmpty' => '=', 'reserved' => FALSE],
431
+            '&' => ['prefix' => '&', 'separator' => '&', 'named' => TRUE, 'ifEmpty' => '=', 'reserved' => FALSE],
432 432
         ];
433 433
 
434 434
         return preg_replace_callback('~{([+#./;?&])?([^}]+?)}~', function($m) use ($url, & $parameters, $operatorFlags) {
@@ -463,17 +463,17 @@  discard block
 block discarded – undo
463 463
                     if ($explode) {
464 464
                         $parts = [];
465 465
                         if ($isAssoc) {
466
-                            $this->walk($value, function ($v, $k) use (& $parts, $flags, $maxLength) {
466
+                            $this->walk($value, function($v, $k) use (& $parts, $flags, $maxLength) {
467 467
                                 $parts[] = $this->prefix(['named' => TRUE] + $flags, $k, $this->escape($flags, $v, $maxLength));
468 468
                             });
469 469
 
470 470
                         } elseif ($flags['named']) {
471
-                            $this->walk($value, function ($v) use (& $parts, $flags, $name, $maxLength) {
471
+                            $this->walk($value, function($v) use (& $parts, $flags, $name, $maxLength) {
472 472
                                 $parts[] = $this->prefix($flags, $name, $this->escape($flags, $v, $maxLength));
473 473
                             });
474 474
 
475 475
                         } else {
476
-                            $this->walk($value, function ($v) use (& $parts, $flags, $maxLength) {
476
+                            $this->walk($value, function($v) use (& $parts, $flags, $maxLength) {
477 477
                                 $parts[] = $this->escape($flags, $v, $maxLength);
478 478
                             });
479 479
                         }
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
             }
505 505
 
506 506
             if (isset($translated[0])) {
507
-                return $flags['prefix'] . implode($flags['separator'], $translated);
507
+                return $flags['prefix'].implode($flags['separator'], $translated);
508 508
             }
509 509
 
510 510
             return '';
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
             }
531 531
         }
532 532
 
533
-        return $prefix . $value;
533
+        return $prefix.$value;
534 534
     }
535 535
 
536 536
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
         $value = (string) $value;
546 546
 
547 547
         if ($maxLength !== NULL) {
548
-            if (preg_match('~^(.{' . $maxLength . '}).~u', $value, $m)) {
548
+            if (preg_match('~^(.{'.$maxLength.'}).~u', $value, $m)) {
549 549
                 $value = $m[1];
550 550
             } elseif (strlen($value) > $maxLength) {  # when malformed UTF-8
551 551
                 $value = substr($value, 0, $maxLength);
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 
559 559
             $escaped = '';
560 560
             for ($i = 0, $count = count($parts); $i < $count; $i += 2) {
561
-                $escaped .= rawurlencode($parts[$i]) . $parts[$i + 1];
561
+                $escaped .= rawurlencode($parts[$i]).$parts[$i + 1];
562 562
             }
563 563
 
564 564
             return $escaped;
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 
597 597
         if (isset($content->errors)) {
598 598
             $message .= implode(', ', array_map(function($error) {
599
-                return '[' . implode(':', (array) $error) . ']';
599
+                return '['.implode(':', (array) $error).']';
600 600
             }, $content->errors));
601 601
         }
602 602
 
Please login to merge, or discard this patch.