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.
Test Failed
Push — master ( 86daef...c5fc1e )
by sunsky
02:09
created
src/Request.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	}
76 76
 
77 77
 	/**
78
-	 * @param $field alias or field name
78
+	 * @param string $field alias or field name
79 79
 	 * @return bool|mixed
80 80
 	 */
81 81
 	public function getIni($field) {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 	/**
242 242
 	 * @param $key
243
-	 * @return mixed
243
+	 * @return string
244 244
 	 */
245 245
 	protected static function optionAlias($key) {
246 246
 		$alias = false;
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 		'timeout_ms'      => 'CURLOPT_TIMEOUT_MS', // milliseconds,  libcurl version > 7.36.0 ,
36 36
 	);
37 37
 	public $curlHandle;
38
-    protected $options = array(
39
-        'CURLOPT_MAXREDIRS' => 10,
40
-        'header' => true,
41
-        'method' => self::GET,
42
-        'transfer' => true,
43
-        'follow_location' => true,
44
-        'timeout' => 0);
45
-    protected $endCallback;
38
+	protected $options = array(
39
+		'CURLOPT_MAXREDIRS' => 10,
40
+		'header' => true,
41
+		'method' => self::GET,
42
+		'transfer' => true,
43
+		'follow_location' => true,
44
+		'timeout' => 0);
45
+	protected $endCallback;
46 46
 	protected $withURIQuery;
47 47
 	protected static $logger;
48 48
 	protected $uri;
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 
114 114
 	public function addOptions(array $options = array()) {
115 115
 		$this->options = $options+$this->options;
116
-        $this->uri = $this->options['url'];
117
-        return $this;
116
+		$this->uri = $this->options['url'];
117
+		return $this;
118 118
 	}
119 119
 
120 120
 	/*  no body  */
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @return Response
152 152
 	 */
153 153
 	public function send() {
154
-        $this->applyOptions();
154
+		$this->applyOptions();
155 155
 		$response = $this->makeResponse();
156 156
 		if ($this->endCallback) {
157 157
 			$func = $this->endCallback;
@@ -168,21 +168,21 @@  discard block
 block discarded – undo
168 168
 	}
169 169
 
170 170
 	protected function prepare() {
171
-        if (empty($this->options['url'])) {
172
-            throw new InvalidArgumentException('url can not empty');
173
-        }
174
-
175
-        if (isset($this->options['data'])) {
176
-            $this->options['data'] = is_array($this->options['data'])?http_build_query($this->options['data']):$this->options['data'];//for better compatibility
177
-        }
178
-        if (isset($this->withURIQuery)) {
179
-            $this->options['url'] .= strpos($this->options['url'], '?') === FALSE?'?':'&';
180
-            $this->options['url'] .= $this->withURIQuery;
181
-        }
182
-        if (isset($this->options['callback'])) {
183
-            $this->onEnd($this->options['callback']);
184
-            unset($this->options['callback']);
185
-        }
171
+		if (empty($this->options['url'])) {
172
+			throw new InvalidArgumentException('url can not empty');
173
+		}
174
+
175
+		if (isset($this->options['data'])) {
176
+			$this->options['data'] = is_array($this->options['data'])?http_build_query($this->options['data']):$this->options['data'];//for better compatibility
177
+		}
178
+		if (isset($this->withURIQuery)) {
179
+			$this->options['url'] .= strpos($this->options['url'], '?') === FALSE?'?':'&';
180
+			$this->options['url'] .= $this->withURIQuery;
181
+		}
182
+		if (isset($this->options['callback'])) {
183
+			$this->onEnd($this->options['callback']);
184
+			unset($this->options['callback']);
185
+		}
186 186
 		//swap ip and host
187 187
 		if (!empty($this->options['ip'])) {
188 188
 			$matches = array();
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
 		$cURLOptions = self::filterAndRaw($this->options);
221 221
 
222
-        curl_setopt_array($this->curlHandle,  $cURLOptions);
222
+		curl_setopt_array($this->curlHandle,  $cURLOptions);
223 223
 
224 224
 		return $this;
225 225
 	}
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		$opts = array();
229 229
 		foreach ($options as $key => $val) {
230 230
 			$alias = self::optionAlias($key);
231
-            $options[$alias] = $val;
232
-            if ($alias) {$opts[constant($alias)] = $val;
233
-            }
234
-            unset($options[$key]);
235
-        }
231
+			$options[$alias] = $val;
232
+			if ($alias) {$opts[constant($alias)] = $val;
233
+			}
234
+			unset($options[$key]);
235
+		}
236 236
 		return $opts;
237 237
 	}
238 238
 
@@ -254,26 +254,26 @@  discard block
 block discarded – undo
254 254
 		$info     = curl_getinfo($this->curlHandle);
255 255
 		$errno    = curl_errno($this->curlHandle);
256 256
 		$error    = curl_error($this->curlHandle);
257
-        $response = Response::create($this, $body, $info, $errno, $error);
258
-        self::log($response);
257
+		$response = Response::create($this, $body, $info, $errno, $error);
258
+		self::log($response);
259 259
 		return $response;
260 260
 	}
261 261
 
262
-    private static function log(Response $response)
263
-    {
264
-        if (is_null(self::$logger)) {
265
-            return;
266
-        }
267
-        if($response->hasErrors()){
268
-            self::$logger->error($response->request->getURI() . "\t" . $response->error, array(
269
-                'response' => print_r($response,1),
270
-            ));
271
-        }
272
-
273
-    }
274
-
275
-    public static function setLogger($logger)
276
-    {
277
-        self::$logger = $logger;
278
-    }
262
+	private static function log(Response $response)
263
+	{
264
+		if (is_null(self::$logger)) {
265
+			return;
266
+		}
267
+		if($response->hasErrors()){
268
+			self::$logger->error($response->request->getURI() . "\t" . $response->error, array(
269
+				'response' => print_r($response,1),
270
+			));
271
+		}
272
+
273
+	}
274
+
275
+	public static function setLogger($logger)
276
+	{
277
+		self::$logger = $logger;
278
+	}
279 279
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	protected static $curlAlias = array(
18 18
 		'url'             => 'CURLOPT_URL',
19 19
 		'uri'             => 'CURLOPT_URL',
20
-		'debug'           => 'CURLOPT_VERBOSE',//for debug verbose
20
+		'debug'           => 'CURLOPT_VERBOSE', //for debug verbose
21 21
 		'method'          => 'CURLOPT_CUSTOMREQUEST',
22 22
 		'data'            => 'CURLOPT_POSTFIELDS', // array or string , file begin with '@'
23 23
 		'ua'              => 'CURLOPT_USERAGENT',
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$alias = self::optionAlias($field);
84 84
 //		if (null === ($rawField = constant($alias))) {throw new InvalidArgumentException('field is invalid');
85 85
 //		}
86
-		return isset($this->options[$alias])?$this->options[$alias]:false;
86
+		return isset($this->options[$alias]) ? $this->options[$alias] : false;
87 87
 	}
88 88
 
89 89
 
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
         }
174 174
 
175 175
         if (isset($this->options['data'])) {
176
-            $this->options['data'] = is_array($this->options['data'])?http_build_query($this->options['data']):$this->options['data'];//for better compatibility
176
+            $this->options['data'] = is_array($this->options['data']) ? http_build_query($this->options['data']) : $this->options['data']; //for better compatibility
177 177
         }
178 178
         if (isset($this->withURIQuery)) {
179
-            $this->options['url'] .= strpos($this->options['url'], '?') === FALSE?'?':'&';
179
+            $this->options['url'] .= strpos($this->options['url'], '?') === FALSE ? '?' : '&';
180 180
             $this->options['url'] .= $this->withURIQuery;
181 181
         }
182 182
         if (isset($this->options['callback'])) {
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
 		$cURLOptions = self::filterAndRaw($this->options);
221 221
 
222
-        curl_setopt_array($this->curlHandle,  $cURLOptions);
222
+        curl_setopt_array($this->curlHandle, $cURLOptions);
223 223
 
224 224
 		return $this;
225 225
 	}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		return $alias;
251 251
 	}
252 252
 	public function makeResponse($isMultiCurl = false) {
253
-		$body     = $isMultiCurl?curl_multi_getcontent($this->curlHandle):curl_exec($this->curlHandle);
253
+		$body     = $isMultiCurl ? curl_multi_getcontent($this->curlHandle) : curl_exec($this->curlHandle);
254 254
 		$info     = curl_getinfo($this->curlHandle);
255 255
 		$errno    = curl_errno($this->curlHandle);
256 256
 		$error    = curl_error($this->curlHandle);
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
         if (is_null(self::$logger)) {
265 265
             return;
266 266
         }
267
-        if($response->hasErrors()){
268
-            self::$logger->error($response->request->getURI() . "\t" . $response->error, array(
269
-                'response' => print_r($response,1),
267
+        if ($response->hasErrors()) {
268
+            self::$logger->error($response->request->getURI()."\t".$response->error, array(
269
+                'response' => print_r($response, 1),
270 270
             ));
271 271
         }
272 272
 
Please login to merge, or discard this patch.
src/Exception/InvalidOperationException.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,5 +13,5 @@
 block discarded – undo
13 13
 
14 14
 
15 15
 class InvalidOperationException extends \LogicException{
16
-    protected $code = 2;
16
+	protected $code = 2;
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 namespace MultiHttp\Exception;
13 13
 
14 14
 
15
-class InvalidOperationException extends \LogicException{
15
+class InvalidOperationException extends \LogicException {
16 16
     protected $code = 2;
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exception/UnexpectedResponseException.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,5 +13,5 @@
 block discarded – undo
13 13
 
14 14
 
15 15
 class UnexpectedResponseException extends \UnexpectedValueException {
16
-    protected $code = 3;
16
+	protected $code = 3;
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exception/InvalidArgumentException.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,5 +13,5 @@
 block discarded – undo
13 13
 
14 14
 
15 15
 class InvalidArgumentException extends \LogicException{
16
-    protected $code = 1;
16
+	protected $code = 1;
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 namespace MultiHttp\Exception;
13 13
 
14 14
 
15
-class InvalidArgumentException extends \LogicException{
15
+class InvalidArgumentException extends \LogicException {
16 16
     protected $code = 1;
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/Response.php 3 patches
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,10 +54,11 @@
 block discarded – undo
54 54
             $headers = explode(PHP_EOL, $headers);
55 55
             array_shift($headers); // HTTP HEADER
56 56
             foreach($headers as $h) {
57
-                if(false !== strpos($h, ':'))
58
-                    list($k, $v) = explode(':', $h, 2);
59
-                else
60
-                    list($k, $v) = array($h,'');
57
+                if(false !== strpos($h, ':')) {
58
+                                    list($k, $v) = explode(':', $h, 2);
59
+                } else {
60
+                                    list($k, $v) = array($h,'');
61
+                }
61 62
 
62 63
                 $this->header[trim($k)] = trim($v);
63 64
             }
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -15,80 +15,80 @@
 block discarded – undo
15 15
 
16 16
 class Response
17 17
 {
18
-    public
19
-        $code,
20
-        $errorCode,
21
-        $error,
22
-        $header,
23
-        $body,
24
-        /**
25
-         * @var Request
26
-         */
27
-        $request,
28
-        $contentType,
29
-        $charset,
30
-        $duration,
31
-        $info;
32
-    protected function __construct()
33
-    {
34
-    }
18
+	public
19
+		$code,
20
+		$errorCode,
21
+		$error,
22
+		$header,
23
+		$body,
24
+		/**
25
+		 * @var Request
26
+		 */
27
+		$request,
28
+		$contentType,
29
+		$charset,
30
+		$duration,
31
+		$info;
32
+	protected function __construct()
33
+	{
34
+	}
35 35
 
36
-    public static function create(Request $request, $body, $info, $errorCode, $error){
37
-        $self = new self;
38
-        $self->request = $request;
39
-        $self->body = $body;
40
-        $self->info = $info;
41
-        $self->errorCode = $errorCode;
42
-        $self->error = $error;
43
-        $self->parse();
44
-        $self->check();
45
-        return $self;
46
-    }
47
-    public function check(){
36
+	public static function create(Request $request, $body, $info, $errorCode, $error){
37
+		$self = new self;
38
+		$self->request = $request;
39
+		$self->body = $body;
40
+		$self->info = $info;
41
+		$self->errorCode = $errorCode;
42
+		$self->error = $error;
43
+		$self->parse();
44
+		$self->check();
45
+		return $self;
46
+	}
47
+	public function check(){
48 48
 
49
-    }
50
-    public function parse(){
51
-        if($this->body && $this->request->getIni('header')){//has header
52
-            $headers = rtrim(substr($this->body, 0, $this->info['header_size']));
53
-            $this->body = substr($this->body, $this->info['header_size']);
54
-            $headers = explode(PHP_EOL, $headers);
55
-            array_shift($headers); // HTTP HEADER
56
-            foreach($headers as $h) {
57
-                if(false !== strpos($h, ':'))
58
-                    list($k, $v) = explode(':', $h, 2);
59
-                else
60
-                    list($k, $v) = array($h,'');
49
+	}
50
+	public function parse(){
51
+		if($this->body && $this->request->getIni('header')){//has header
52
+			$headers = rtrim(substr($this->body, 0, $this->info['header_size']));
53
+			$this->body = substr($this->body, $this->info['header_size']);
54
+			$headers = explode(PHP_EOL, $headers);
55
+			array_shift($headers); // HTTP HEADER
56
+			foreach($headers as $h) {
57
+				if(false !== strpos($h, ':'))
58
+					list($k, $v) = explode(':', $h, 2);
59
+				else
60
+					list($k, $v) = array($h,'');
61 61
 
62
-                $this->header[trim($k)] = trim($v);
63
-            }
64
-        }
65
-        $this->code = $this->info['http_code'];
66
-        $this->duration = $this->info['total_time'];
67
-        $this->contentType = $this->info['content_type'];
68
-        $content_type = isset($this->info['content_type']) ? $this->info['content_type'] : '';
69
-        $content_type = explode(';', $content_type);
70
-        $this->contentType = $content_type[0];
71
-        if (count($content_type) == 2 && strpos($content_type[1], '=') !== false) {
72
-            list( , $this->charset) = explode('=', $content_type[1]);
73
-        }
74
-    }
62
+				$this->header[trim($k)] = trim($v);
63
+			}
64
+		}
65
+		$this->code = $this->info['http_code'];
66
+		$this->duration = $this->info['total_time'];
67
+		$this->contentType = $this->info['content_type'];
68
+		$content_type = isset($this->info['content_type']) ? $this->info['content_type'] : '';
69
+		$content_type = explode(';', $content_type);
70
+		$this->contentType = $content_type[0];
71
+		if (count($content_type) == 2 && strpos($content_type[1], '=') !== false) {
72
+			list( , $this->charset) = explode('=', $content_type[1]);
73
+		}
74
+	}
75 75
 
76
-    /**
77
-     * Status Code Definitions
78
-     *
79
-     * Informational 1xx
80
-     * Successful    2xx
81
-     * Redirection   3xx
82
-     * Client Error  4xx
83
-     * Server Error  5xx
84
-     *
85
-     * http://pretty-rfc.herokuapp.com/RFC2616#status.codes
86
-     *
87
-     * @return bool Did we receive a 4xx or 5xx?
88
-     */
89
-    public function hasErrors()
90
-    {
91
-        return $this->code == 0 || $this->code >= 400;
92
-    }
76
+	/**
77
+	 * Status Code Definitions
78
+	 *
79
+	 * Informational 1xx
80
+	 * Successful    2xx
81
+	 * Redirection   3xx
82
+	 * Client Error  4xx
83
+	 * Server Error  5xx
84
+	 *
85
+	 * http://pretty-rfc.herokuapp.com/RFC2616#status.codes
86
+	 *
87
+	 * @return bool Did we receive a 4xx or 5xx?
88
+	 */
89
+	public function hasErrors()
90
+	{
91
+		return $this->code == 0 || $this->code >= 400;
92
+	}
93 93
 
94 94
 }
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     {
34 34
     }
35 35
 
36
-    public static function create(Request $request, $body, $info, $errorCode, $error){
36
+    public static function create(Request $request, $body, $info, $errorCode, $error) {
37 37
         $self = new self;
38 38
         $self->request = $request;
39 39
         $self->body = $body;
@@ -44,20 +44,20 @@  discard block
 block discarded – undo
44 44
         $self->check();
45 45
         return $self;
46 46
     }
47
-    public function check(){
47
+    public function check() {
48 48
 
49 49
     }
50
-    public function parse(){
51
-        if($this->body && $this->request->getIni('header')){//has header
50
+    public function parse() {
51
+        if ($this->body && $this->request->getIni('header')) {//has header
52 52
             $headers = rtrim(substr($this->body, 0, $this->info['header_size']));
53 53
             $this->body = substr($this->body, $this->info['header_size']);
54 54
             $headers = explode(PHP_EOL, $headers);
55 55
             array_shift($headers); // HTTP HEADER
56
-            foreach($headers as $h) {
57
-                if(false !== strpos($h, ':'))
56
+            foreach ($headers as $h) {
57
+                if (false !== strpos($h, ':'))
58 58
                     list($k, $v) = explode(':', $h, 2);
59 59
                 else
60
-                    list($k, $v) = array($h,'');
60
+                    list($k, $v) = array($h, '');
61 61
 
62 62
                 $this->header[trim($k)] = trim($v);
63 63
             }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $content_type = explode(';', $content_type);
70 70
         $this->contentType = $content_type[0];
71 71
         if (count($content_type) == 2 && strpos($content_type[1], '=') !== false) {
72
-            list( , $this->charset) = explode('=', $content_type[1]);
72
+            list(, $this->charset) = explode('=', $content_type[1]);
73 73
         }
74 74
     }
75 75
 
Please login to merge, or discard this patch.
src/MultiRequest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 * @return array(Response)
70 70
 	 */
71 71
 	public function execute() {
72
-		$sleepTime = 1000;//microsecond, prevent  CPU 100%
73
-        do{
72
+		$sleepTime = 1000; //microsecond, prevent  CPU 100%
73
+        do {
74 74
             curl_multi_exec(self::$multiHandler, $active);
75 75
             // bug in PHP 5.3.18+ where curl_multi_select can return -1
76 76
 			// https://bugs.php.net/bug.php?id=63411
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                 usleep($sleepTime);
79 79
             }
80 80
             usleep($sleepTime);
81
-        }while($active);
81
+        }while ($active);
82 82
         $return = array();
83 83
 		foreach (self::$requestPool as $request) {
84 84
 			$response = $request->makeResponse(true);
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -70,25 +70,25 @@
 block discarded – undo
70 70
 	 */
71 71
 	public function execute() {
72 72
 		$sleepTime = 1000;//microsecond, prevent  CPU 100%
73
-        do{
74
-            curl_multi_exec(self::$multiHandler, $active);
75
-            // bug in PHP 5.3.18+ where curl_multi_select can return -1
73
+		do{
74
+			curl_multi_exec(self::$multiHandler, $active);
75
+			// bug in PHP 5.3.18+ where curl_multi_select can return -1
76 76
 			// https://bugs.php.net/bug.php?id=63411
77
-            if (curl_multi_select(self::$multiHandler) == -1) {
78
-                usleep($sleepTime);
79
-            }
80
-            usleep($sleepTime);
81
-        }while($active);
82
-        $return = array();
77
+			if (curl_multi_select(self::$multiHandler) == -1) {
78
+				usleep($sleepTime);
79
+			}
80
+			usleep($sleepTime);
81
+		}while($active);
82
+		$return = array();
83 83
 		foreach (self::$requestPool as $request) {
84 84
 			$response = $request->makeResponse(true);
85
-            $func = $response->request->endCallback();
85
+			$func = $response->request->endCallback();
86 86
 			if (isset($func)) {
87 87
 				$func($response);
88 88
 			}
89 89
 			$return[] = $response;
90
-            curl_multi_remove_handle(self::$multiHandler, $request->curlHandle);
91
-            curl_close($request->curlHandle);
90
+			curl_multi_remove_handle(self::$multiHandler, $request->curlHandle);
91
+			curl_close($request->curlHandle);
92 92
 		}
93 93
 		curl_multi_close(self::$multiHandler);
94 94
 		self::$requestPool = null;
Please login to merge, or discard this patch.