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.
Completed
Push — master ( 8b3e24...386c7e )
by Oleg
01:14
created
src/Route4Me/Route4Me.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$rpath = realpath($fname);
46 46
 		
47
-		$fp=fopen(realpath($fname),"r");
47
+		$fp = fopen(realpath($fname), "r");
48 48
 		
49
-		$url = self::$baseUrl.$options['url'] . '?' . http_build_query(array_merge(
50
-            array( 'api_key' => self::getApiKey()), $query)
49
+		$url = self::$baseUrl.$options['url'].'?'.http_build_query(array_merge(
50
+            array('api_key' => self::getApiKey()), $query)
51 51
         );
52 52
 		
53 53
 		//self::simplePrint($body);die("");
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		//echo "code = $code <br>";
82 82
 		$json = json_decode($result, true);
83 83
 		//var_dump($json); die("");
84
-        if (200 == $code) {
84
+        if (200==$code) {
85 85
             return $json;
86 86
         } elseif (isset($json['errors'])) {
87 87
             throw new ApiError(implode(', ', $json['errors']));
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     public static function makeRequst($options) {
94 94
         $errorHandler = new myErrorHandler();
95 95
     
96
-        $old_error_handler = set_error_handler(array( $errorHandler, "proc_error"));
96
+        $old_error_handler = set_error_handler(array($errorHandler, "proc_error"));
97 97
         $method = isset($options['method']) ? $options['method'] : 'GET';
98 98
         $query = isset($options['query']) ?
99 99
             array_filter($options['query']) : array();
@@ -106,26 +106,26 @@  discard block
 block discarded – undo
106 106
         );
107 107
         
108 108
         if (isset($options['HTTPHEADER'])) {
109
-            $headers[]=$options['HTTPHEADER'];
109
+            $headers[] = $options['HTTPHEADER'];
110 110
         }
111 111
 
112 112
 		if (isset($options['HTTPHEADERS'])) {
113
-		    foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
113
+		    foreach ($options['HTTPHEADERS'] As $header) $headers[] = $header;
114 114
         }
115 115
         //self::simplePrint($headers); die("");
116 116
         $ch = curl_init();
117
-        $url = $options['url'] . '?' . http_build_query(array_merge(
118
-            $query, array( 'api_key' => self::getApiKey())
117
+        $url = $options['url'].'?'.http_build_query(array_merge(
118
+            $query, array('api_key' => self::getApiKey())
119 119
         ));
120 120
 		//var_dump($body); echo "<br><br>";
121 121
 		//$jfile=json_encode($body); echo "<br><br>".$jfile; die("STOPPPP");
122 122
 
123 123
         //self::simplePrint($headers); die("");
124
-		$baseUrl=self::getBaseUrl();
124
+		$baseUrl = self::getBaseUrl();
125 125
 		
126
-		if (strpos($url,'move_route_destination')>0) $baseUrl='https://api.route4me.com';
126
+		if (strpos($url, 'move_route_destination')>0) $baseUrl = 'https://api.route4me.com';
127 127
         $curlOpts = arraY(
128
-            CURLOPT_URL            => $baseUrl. $url,
128
+            CURLOPT_URL            => $baseUrl.$url,
129 129
             CURLOPT_RETURNTRANSFER => true,
130 130
             CURLOPT_TIMEOUT        => 60,
131 131
             CURLOPT_FOLLOWLOCATION => true,
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 		//echo "url=".$baseUrl.$url."<br>";die("");
138 138
         curl_setopt_array($ch, $curlOpts);
139 139
 		
140
-		if ($file !=null) {
140
+		if ($file!=null) {
141 141
 			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
142
-			$fp=fopen($file,'r');
143
-			curl_setopt($ch, CURLOPT_INFILE , $fp);
142
+			$fp = fopen($file, 'r');
143
+			curl_setopt($ch, CURLOPT_INFILE, $fp);
144 144
 			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
145 145
 		}
146 146
 		
147
-        switch($method) {
147
+        switch ($method) {
148 148
         case 'DELETE':
149 149
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
150 150
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 			break;
170 170
         case 'POST':
171 171
 			if (isset($query)) {
172
-            	curl_setopt($ch,  CURLOPT_POSTFIELDS, json_encode($query)); 
172
+            	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
173 173
 			}
174 174
             
175 175
 			//echo "<br><br>". json_encode($body); 
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 
184 184
         $result = curl_exec($ch);
185 185
 		//var_dump($result); die("");
186
-		$isxml=FALSE;
187
-		$jxml="";
186
+		$isxml = FALSE;
187
+		$jxml = "";
188 188
 		if (strpos($result, '<?xml')>-1)
189 189
 		{
190 190
 			$xml = simplexml_load_string($result);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         curl_close($ch);
197 197
 		//echo "code -> $code <br>";
198 198
 		
199
-        if (200 == $code) {
199
+        if (200==$code) {
200 200
             if ($isxml) {
201 201
                 $json = $jxml;
202 202
             } else $json = json_decode($result, true);
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             } else {
207 207
                 return $json;
208 208
             }
209
-        }  elseif (409 == $code) {
209
+        }  elseif (409==$code) {
210 210
             throw new ApiError('Wrong API key');
211 211
         } else {
212 212
             throw new ApiError('Something wrong');
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		
236 236
 		curl_setopt_array($ch, $curlOpts);
237 237
 		
238
-        switch($method) {
238
+        switch ($method) {
239 239
         case 'DELETE':
240 240
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
241 241
 
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$result = curl_exec($ch);
275 275
         
276
-		$isxml=FALSE;
277
-		$jxml="";
276
+		$isxml = FALSE;
277
+		$jxml = "";
278 278
 		if (strpos($result, '<?xml')>-1)
279 279
 		{
280 280
 			$xml = simplexml_load_string($result);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 		} else $json = json_decode($result, true);
291 291
 		
292 292
 		
293
-        if (200 == $code) {
293
+        if (200==$code) {
294 294
             return $json;
295 295
         } elseif (isset($json['errors'])) {
296 296
             throw new ApiError(implode(', ', $json['errors']));
Please login to merge, or discard this patch.
Braces   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,13 +34,17 @@  discard block
 block discarded – undo
34 34
 		$query = isset($options['query']) ?
35 35
             array_filter($options['query']) : array();
36 36
 
37
-		if (sizeof($query)==0) return null;
37
+		if (sizeof($query)==0) {
38
+			return null;
39
+		}
38 40
 
39 41
 		$body = isset($options['body']) ?
40 42
             array_filter($options['body']) : null;
41 43
 			
42 44
 		$fname = isset($body['strFilename']) ? $body['strFilename'] : '';
43
-		if ($fname=='') return null;
45
+		if ($fname=='') {
46
+			return null;
47
+		}
44 48
 
45 49
 		$rpath = realpath($fname);
46 50
 		
@@ -110,7 +114,9 @@  discard block
 block discarded – undo
110 114
         }
111 115
 
112 116
 		if (isset($options['HTTPHEADERS'])) {
113
-		    foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
117
+		    foreach ($options['HTTPHEADERS'] As $header) {
118
+		    	$headers[]=$header;
119
+		    }
114 120
         }
115 121
         //self::simplePrint($headers); die("");
116 122
         $ch = curl_init();
@@ -123,7 +129,9 @@  discard block
 block discarded – undo
123 129
         //self::simplePrint($headers); die("");
124 130
 		$baseUrl=self::getBaseUrl();
125 131
 		
126
-		if (strpos($url,'move_route_destination')>0) $baseUrl='https://api.route4me.com';
132
+		if (strpos($url,'move_route_destination')>0) {
133
+			$baseUrl='https://api.route4me.com';
134
+		}
127 135
         $curlOpts = arraY(
128 136
             CURLOPT_URL            => $baseUrl. $url,
129 137
             CURLOPT_RETURNTRANSFER => true,
@@ -199,14 +207,16 @@  discard block
 block discarded – undo
199 207
         if (200 == $code) {
200 208
             if ($isxml) {
201 209
                 $json = $jxml;
202
-            } else $json = json_decode($result, true);
210
+            } else {
211
+            	$json = json_decode($result, true);
212
+            }
203 213
             //var_dump($json); die("");
204 214
             if (isset($json['errors'])) {
205 215
                 throw new ApiError(implode(', ', $json['errors']));
206 216
             } else {
207 217
                 return $json;
208 218
             }
209
-        }  elseif (409 == $code) {
219
+        } elseif (409 == $code) {
210 220
             throw new ApiError('Wrong API key');
211 221
         } else {
212 222
             throw new ApiError('Something wrong');
@@ -287,7 +297,9 @@  discard block
 block discarded – undo
287 297
 		
288 298
 		if ($isxml) {
289 299
 			$json = $jxml;
290
-		} else $json = json_decode($result, true);
300
+		} else {
301
+			$json = json_decode($result, true);
302
+		}
291 303
 		
292 304
 		
293 305
         if (200 == $code) {
Please login to merge, or discard this patch.