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 ( 8e4cc8...6e1047 )
by Oleg
33s
created
src/Route4Me/Route4Me.php 1 patch
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -6,37 +6,37 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Route4Me
8 8
 {
9
-    static public $apiKey;
10
-    static public $baseUrl = 'https://route4me.com';
9
+	static public $apiKey;
10
+	static public $baseUrl = 'https://route4me.com';
11 11
 
12
-    public static function setApiKey($apiKey)
13
-    {
14
-        self::$apiKey = $apiKey;
15
-    }
12
+	public static function setApiKey($apiKey)
13
+	{
14
+		self::$apiKey = $apiKey;
15
+	}
16 16
 
17
-    public static function getApiKey()
18
-    {
19
-        return self::$apiKey;
20
-    }
17
+	public static function getApiKey()
18
+	{
19
+		return self::$apiKey;
20
+	}
21 21
 
22
-    public static function setBaseUrl($baseUrl)
23
-    {
24
-        self::$baseUrl = $baseUrl;
25
-    }
22
+	public static function setBaseUrl($baseUrl)
23
+	{
24
+		self::$baseUrl = $baseUrl;
25
+	}
26 26
 
27
-    public static function getBaseUrl()
28
-    {
29
-        return self::$baseUrl;
30
-    }
27
+	public static function getBaseUrl()
28
+	{
29
+		return self::$baseUrl;
30
+	}
31 31
 	
32 32
 	public static function fileUploadRequest($options) {
33 33
 		$query = isset($options['query']) ?
34
-            array_filter($options['query']) : array();
34
+			array_filter($options['query']) : array();
35 35
 
36 36
 		if (sizeof($query)==0) return null;
37 37
 
38 38
 		$body = isset($options['body']) ?
39
-            array_filter($options['body']) : null;
39
+			array_filter($options['body']) : null;
40 40
 			
41 41
 		$fname = isset($body['strFilename']) ? $body['strFilename'] : '';
42 42
 		if ($fname=='') return null;
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 		$fp=fopen(realpath($fname),"r");
47 47
 		
48 48
 		$url = self::$baseUrl.$options['url'] . '?' . http_build_query(array_merge(
49
-            array( 'api_key' => self::getApiKey()), $query)
50
-        );
49
+			array( 'api_key' => self::getApiKey()), $query)
50
+		);
51 51
 		
52 52
 		//self::simplePrint($body);die("");
53 53
 		//echo "url=".$url."<br>";die("");
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 		$ch = curl_init($url);
56 56
 		
57 57
 		$curlOpts = array(
58
-            CURLOPT_RETURNTRANSFER => true,
59
-            CURLOPT_TIMEOUT        => 60,
60
-            CURLOPT_FOLLOWLOCATION => true,
61
-            CURLOPT_SSL_VERIFYHOST => FALSE,
62
-            CURLOPT_SSL_VERIFYPEER => FALSE
63
-        );
58
+			CURLOPT_RETURNTRANSFER => true,
59
+			CURLOPT_TIMEOUT        => 60,
60
+			CURLOPT_FOLLOWLOCATION => true,
61
+			CURLOPT_SSL_VERIFYHOST => FALSE,
62
+			CURLOPT_SSL_VERIFYPEER => FALSE
63
+		);
64 64
 		
65 65
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
66 66
 		
@@ -76,62 +76,62 @@  discard block
 block discarded – undo
76 76
 		fclose($fp);
77 77
 		//var_dump($result); die('');
78 78
 		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
79
-        curl_close($ch);
79
+		curl_close($ch);
80 80
 		//echo "code = $code <br>";
81 81
 		$json = json_decode($result, true);
82 82
 		//var_dump($json); die("");
83
-        if (200 == $code) {
84
-            return $json;
85
-        } elseif (isset($json['errors'])) {
86
-            throw new ApiError(implode(', ', $json['errors']));
87
-        } else {
88
-            throw new ApiError('Something wrong');
89
-        }
83
+		if (200 == $code) {
84
+			return $json;
85
+		} elseif (isset($json['errors'])) {
86
+			throw new ApiError(implode(', ', $json['errors']));
87
+		} else {
88
+			throw new ApiError('Something wrong');
89
+		}
90 90
 	}
91 91
 
92
-    public static function makeRequst($options) {
93
-        $method = isset($options['method']) ? $options['method'] : 'GET';
94
-        $query = isset($options['query']) ?
95
-            array_filter($options['query']) : array();
92
+	public static function makeRequst($options) {
93
+		$method = isset($options['method']) ? $options['method'] : 'GET';
94
+		$query = isset($options['query']) ?
95
+			array_filter($options['query']) : array();
96 96
 		//echo "query=".$query['member_id'];die("");
97
-        $body = isset($options['body']) ?
98
-            array_filter($options['body']) : null;
97
+		$body = isset($options['body']) ?
98
+			array_filter($options['body']) : null;
99 99
 		$file = isset($options['FILE']) ? $options['FILE'] : null;
100
-        $headers = array(
101
-            "User-Agent: Route4Me php-sdk"
102
-        );
100
+		$headers = array(
101
+			"User-Agent: Route4Me php-sdk"
102
+		);
103 103
         
104
-        if (isset($options['HTTPHEADER'])) {
105
-            $headers[]=$options['HTTPHEADER'];
106
-        }
104
+		if (isset($options['HTTPHEADER'])) {
105
+			$headers[]=$options['HTTPHEADER'];
106
+		}
107 107
 
108 108
 		if (isset($options['HTTPHEADERS'])) {
109
-		    foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
110
-        }
111
-        //self::simplePrint($headers); die("");
112
-        $ch = curl_init();
113
-        $url = $options['url'] . '?' . http_build_query(array_merge(
114
-            $query, array( 'api_key' => self::getApiKey())
115
-        ));
109
+			foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
110
+		}
111
+		//self::simplePrint($headers); die("");
112
+		$ch = curl_init();
113
+		$url = $options['url'] . '?' . http_build_query(array_merge(
114
+			$query, array( 'api_key' => self::getApiKey())
115
+		));
116 116
 		
117 117
 		//$jfile=json_encode($body); echo $jfile; die("");
118 118
 
119
-        //self::simplePrint($headers); die("");
119
+		//self::simplePrint($headers); die("");
120 120
 		$baseUrl=self::getBaseUrl();
121 121
 		
122 122
 		if (strpos($url,'move_route_destination')>0) $baseUrl='https://www.route4me.com';
123
-        $curlOpts = arraY(
124
-            CURLOPT_URL            => $baseUrl. $url,
125
-            CURLOPT_RETURNTRANSFER => true,
126
-            CURLOPT_TIMEOUT        => 60,
127
-            CURLOPT_FOLLOWLOCATION => true,
128
-            CURLOPT_SSL_VERIFYHOST => FALSE,
129
-            CURLOPT_SSL_VERIFYPEER => FALSE,
130
-            CURLOPT_HTTPHEADER     => $headers
131
-        );
123
+		$curlOpts = arraY(
124
+			CURLOPT_URL            => $baseUrl. $url,
125
+			CURLOPT_RETURNTRANSFER => true,
126
+			CURLOPT_TIMEOUT        => 60,
127
+			CURLOPT_FOLLOWLOCATION => true,
128
+			CURLOPT_SSL_VERIFYHOST => FALSE,
129
+			CURLOPT_SSL_VERIFYPEER => FALSE,
130
+			CURLOPT_HTTPHEADER     => $headers
131
+		);
132 132
 		
133 133
 		//echo "url=".$baseUrl.$url."<br>";die("");
134
-        curl_setopt_array($ch, $curlOpts);
134
+		curl_setopt_array($ch, $curlOpts);
135 135
 		
136 136
 		if ($file !=null) {
137 137
 			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
141 141
 		}
142 142
 		
143
-        switch($method) {
144
-        case 'DELETE':
145
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
143
+		switch($method) {
144
+		case 'DELETE':
145
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
146 146
 
147 147
 			if (isset($body)) {
148 148
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
149 149
 			}
150
-            break;
150
+			break;
151 151
 		case 'DELETEARRAY':
152 152
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
153
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
154
-            break;
155
-        case 'PUT':
153
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
154
+			break;
155
+		case 'PUT':
156 156
 			//$jfile=json_encode($body); echo $jfile; die("");
157
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
157
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
158 158
 			if (isset($query)) {
159 159
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
160 160
 			}
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
164 164
 			}
165 165
 			break;
166
-        case 'POST':
166
+		case 'POST':
167 167
 			if (isset($query)) {
168
-            	curl_setopt($ch,  CURLOPT_POSTFIELDS, json_encode($query)); 
168
+				curl_setopt($ch,  CURLOPT_POSTFIELDS, json_encode($query)); 
169 169
 			}
170 170
             
171 171
 			//echo json_encode($body); die("");
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 			} 
175 175
 			break;
176 176
 		case 'ADD':
177
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
178
-        }
177
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
178
+		}
179 179
 
180
-        $result = curl_exec($ch);
180
+		$result = curl_exec($ch);
181 181
 		//var_dump($result); die("");
182 182
 		$isxml=FALSE;
183 183
 		$jxml="";
@@ -188,58 +188,58 @@  discard block
 block discarded – undo
188 188
 			$isxml = TRUE;
189 189
 		}
190 190
 		
191
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
192
-        curl_close($ch);
191
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
192
+		curl_close($ch);
193 193
 		
194 194
 		if ($isxml) {
195 195
 			$json = $jxml;
196 196
 		} else $json = json_decode($result, true);
197 197
 		//var_dump($json); die("");
198
-        if (200 == $code) {
199
-            return $json;
200
-        } elseif (isset($json['errors'])) {
201
-            throw new ApiError(implode(', ', $json['errors']));
202
-        } else {
203
-            throw new ApiError('Something wrong');
204
-        }
205
-    }
198
+		if (200 == $code) {
199
+			return $json;
200
+		} elseif (isset($json['errors'])) {
201
+			throw new ApiError(implode(', ', $json['errors']));
202
+		} else {
203
+			throw new ApiError('Something wrong');
204
+		}
205
+	}
206 206
 
207 207
 	public static function makeUrlRequst($url, $options) {
208 208
 		$method = isset($options['method']) ? $options['method'] : 'GET';
209
-        $query = isset($options['query']) ?
210
-            array_filter($options['query']) : array();
211
-        $body = isset($options['body']) ?
212
-            array_filter($options['body']) : null;
213
-        $ch = curl_init();
209
+		$query = isset($options['query']) ?
210
+			array_filter($options['query']) : array();
211
+		$body = isset($options['body']) ?
212
+			array_filter($options['body']) : null;
213
+		$ch = curl_init();
214 214
 		
215 215
 		$curlOpts = arraY(
216
-            CURLOPT_URL            => $url,
217
-            CURLOPT_RETURNTRANSFER => true,
218
-            CURLOPT_TIMEOUT        => 60,
219
-            CURLOPT_FOLLOWLOCATION => true,
220
-            CURLOPT_SSL_VERIFYHOST => FALSE,
221
-            CURLOPT_SSL_VERIFYPEER => FALSE,
222
-            CURLOPT_HTTPHEADER     => array(
223
-                'User-Agent' => 'Route4Me php-sdk'
224
-            )
225
-        );
216
+			CURLOPT_URL            => $url,
217
+			CURLOPT_RETURNTRANSFER => true,
218
+			CURLOPT_TIMEOUT        => 60,
219
+			CURLOPT_FOLLOWLOCATION => true,
220
+			CURLOPT_SSL_VERIFYHOST => FALSE,
221
+			CURLOPT_SSL_VERIFYPEER => FALSE,
222
+			CURLOPT_HTTPHEADER     => array(
223
+				'User-Agent' => 'Route4Me php-sdk'
224
+			)
225
+		);
226 226
 		
227 227
 		curl_setopt_array($ch, $curlOpts);
228 228
 		
229
-        switch($method) {
230
-        case 'DELETE':
231
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
229
+		switch($method) {
230
+		case 'DELETE':
231
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
232 232
 
233 233
 			if (isset($body)) {
234 234
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
235 235
 			}
236
-            break;
236
+			break;
237 237
 		case 'DELETEARRAY':
238 238
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
239
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
240
-            break;
241
-        case 'PUT':
242
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
239
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
240
+			break;
241
+		case 'PUT':
242
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
243 243
 			if (isset($query)) {
244 244
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
245 245
 			}
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
249 249
 			}
250 250
 			break;
251
-        case 'POST':
251
+		case 'POST':
252 252
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
253 253
 			if (isset($query)) {
254
-            	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
254
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
255 255
 			}
256 256
 
257 257
 			if (isset($body)) {
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
 			} 
260 260
 			break;
261 261
 		case 'ADD':
262
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
263
-        }
262
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
263
+		}
264 264
 
265 265
 		$result = curl_exec($ch);
266 266
         
@@ -273,21 +273,21 @@  discard block
 block discarded – undo
273 273
 			$isxml = TRUE;
274 274
 		}
275 275
 		
276
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
277
-        curl_close($ch);
276
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
277
+		curl_close($ch);
278 278
 		
279 279
 		if ($isxml) {
280 280
 			$json = $jxml;
281 281
 		} else $json = json_decode($result, true);
282 282
 		
283 283
 		
284
-        if (200 == $code) {
285
-            return $json;
286
-        } elseif (isset($json['errors'])) {
287
-            throw new ApiError(implode(', ', $json['errors']));
288
-        } else {
289
-            throw new ApiError('Something wrong');
290
-        }
284
+		if (200 == $code) {
285
+			return $json;
286
+		} elseif (isset($json['errors'])) {
287
+			throw new ApiError(implode(', ', $json['errors']));
288
+		} else {
289
+			throw new ApiError('Something wrong');
290
+		}
291 291
 	}
292 292
 	
293 293
 	/**
Please login to merge, or discard this patch.