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
Pull Request — master (#3)
by Igor
05:14
created
src/Route4Me/Route4Me.php 1 patch
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'], function($x) { return !is_null($x); } ) : array();
@@ -105,26 +105,26 @@  discard block
 block discarded – undo
105 105
         );
106 106
         
107 107
         if (isset($options['HTTPHEADER'])) {
108
-            $headers[]=$options['HTTPHEADER'];
108
+            $headers[] = $options['HTTPHEADER'];
109 109
         }
110 110
 
111 111
 		if (isset($options['HTTPHEADERS'])) {
112
-		    foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
112
+		    foreach ($options['HTTPHEADERS'] As $header) $headers[] = $header;
113 113
         }
114 114
         //self::simplePrint($headers); die("");
115 115
         $ch = curl_init();
116
-        $url = $options['url'] . '?' . http_build_query(array_merge(
117
-            $query, array( 'api_key' => self::getApiKey())
116
+        $url = $options['url'].'?'.http_build_query(array_merge(
117
+            $query, array('api_key' => self::getApiKey())
118 118
         ));
119 119
 		//var_dump($body); echo "<br><br>";
120 120
 		//$jfile=json_encode($body); echo "<br><br>".$jfile; die("STOPPPP");
121 121
 
122 122
         //self::simplePrint($headers); die("");
123
-		$baseUrl=self::getBaseUrl();
123
+		$baseUrl = self::getBaseUrl();
124 124
 		
125
-		if (strpos($url,'move_route_destination')>0) $baseUrl='https://api.route4me.com';
125
+		if (strpos($url, 'move_route_destination')>0) $baseUrl = 'https://api.route4me.com';
126 126
         $curlOpts = arraY(
127
-            CURLOPT_URL            => $baseUrl. $url,
127
+            CURLOPT_URL            => $baseUrl.$url,
128 128
             CURLOPT_RETURNTRANSFER => true,
129 129
             CURLOPT_TIMEOUT        => 60,
130 130
             CURLOPT_FOLLOWLOCATION => true,
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 		//echo "url=".$baseUrl.$url."<br>";die("");
137 137
         curl_setopt_array($ch, $curlOpts);
138 138
 		
139
-		if ($file !=null) {
139
+		if ($file!=null) {
140 140
 			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
141
-			$fp=fopen($file,'r');
142
-			curl_setopt($ch, CURLOPT_INFILE , $fp);
141
+			$fp = fopen($file, 'r');
142
+			curl_setopt($ch, CURLOPT_INFILE, $fp);
143 143
 			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
144 144
 		}
145 145
 		
146
-        switch($method) {
146
+        switch ($method) {
147 147
         case 'DELETE':
148 148
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
149 149
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			break;
169 169
         case 'POST':
170 170
 			if (isset($query)) {
171
-            	curl_setopt($ch,  CURLOPT_POSTFIELDS, json_encode($query)); 
171
+            	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
172 172
 			}
173 173
             
174 174
 			//echo "<br><br>". json_encode($body); 
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 
183 183
         $result = curl_exec($ch);
184 184
 		//var_dump($result); die("");
185
-		$isxml=FALSE;
186
-		$jxml="";
185
+		$isxml = FALSE;
186
+		$jxml = "";
187 187
 		if (strpos($result, '<?xml')>-1)
188 188
 		{
189 189
 			$xml = simplexml_load_string($result);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         curl_close($ch);
196 196
 		//echo "code -> $code <br>";
197 197
 		
198
-        if (200 == $code) {
198
+        if (200==$code) {
199 199
             if ($isxml) {
200 200
                 $json = $jxml;
201 201
             } else $json = json_decode($result, true);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             } else {
206 206
                 return $json;
207 207
             }
208
-        }  elseif (409 == $code) {
208
+        }  elseif (409==$code) {
209 209
             throw new ApiError('Wrong API key');
210 210
         } else {
211 211
             throw new ApiError('Something wrong');
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		
234 234
 		curl_setopt_array($ch, $curlOpts);
235 235
 		
236
-        switch($method) {
236
+        switch ($method) {
237 237
         case 'DELETE':
238 238
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
239 239
 
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 
272 272
 		$result = curl_exec($ch);
273 273
         
274
-		$isxml=FALSE;
275
-		$jxml="";
274
+		$isxml = FALSE;
275
+		$jxml = "";
276 276
 		if (strpos($result, '<?xml')>-1)
277 277
 		{
278 278
 			$xml = simplexml_load_string($result);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		} else $json = json_decode($result, true);
289 289
 		
290 290
 		
291
-        if (200 == $code) {
291
+        if (200==$code) {
292 292
             return $json;
293 293
         } elseif (isset($json['errors'])) {
294 294
             throw new ApiError(implode(', ', $json['errors']));
Please login to merge, or discard this patch.
src/Route4Me/OptimizationProblem.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
             'method' => 'POST',
71 71
             'query'  => array(
72 72
                 'redirect'               => isset($params->redirect) ? $params->redirect : null,
73
-                'directions'             => isset($params->directions) ? $params->directions: null, 
74
-                'format'                 => isset($params->format) ? $params->format: null,
75
-                'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output: null,
76
-                'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url: null
73
+                'directions'             => isset($params->directions) ? $params->directions : null, 
74
+                'format'                 => isset($params->format) ? $params->format : null,
75
+                'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output : null,
76
+                'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url : null
77 77
             ),
78 78
             'body'   => array(
79 79
                 'addresses'  => $params->getAddressesArray(),
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         if (isset($optimize['optimizations'])) {
104 104
             $problems = array();
105
-            foreach($optimize['optimizations'] as $problem) {
105
+            foreach ($optimize['optimizations'] as $problem) {
106 106
                 $problems[] = OptimizationProblem::fromArray($problem);
107 107
             }
108 108
             return $problems;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         return $this->routes;
146 146
     }
147 147
 	
148
-	public function getRandomOptimizationId($offset,$limit)
148
+	public function getRandomOptimizationId($offset, $limit)
149 149
 	{
150 150
 		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
151 151
         $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
         ));
158 158
 		
159 159
 		$optimizations = array();
160
-            foreach($json as $optimization) {
160
+            foreach ($json as $optimization) {
161 161
 				if (gettype($optimization)!="array") continue;
162 162
 				foreach ($optimization as $otp1) {
163 163
 					$optimizations[] = $otp1;
164 164
 				}
165 165
             }
166 166
 			
167
-			$num=rand(0,sizeof($optimizations)-1);
167
+			$num = rand(0, sizeof($optimizations) - 1);
168 168
 			//echo "num=$num.<br>".sizeof($optimizations)."<br>";
169
-			$rOptimization=$optimizations[$num];
169
+			$rOptimization = $optimizations[$num];
170 170
 			return $rOptimization;
171 171
 	}
172 172
 	
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	{
175 175
 		if ($opt_id==null) return null;
176 176
 		
177
-		$params = array( "optimization_problem_id" => $opt_id );
177
+		$params = array("optimization_problem_id" => $opt_id);
178 178
 		
179 179
 		$optimization = (array)$this->get($params);
180 180
 		
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 	{
189 189
 		$addresses = (array)$this->getAddresses($opt_id);
190 190
 		
191
-		if ($addresses == null) {
191
+		if ($addresses==null) {
192 192
 			echo "There are no addresses in this optimization!.. Try again.";
193 193
 			return null;
194 194
 		}
195 195
 		
196
-		$num=rand(0,sizeof($addresses)-1);
197
-		$rAddress=$addresses[$num];
196
+		$num = rand(0, sizeof($addresses) - 1);
197
+		$rAddress = $addresses[$num];
198 198
 		
199 199
 		return $rAddress;
200 200
 	}
Please login to merge, or discard this patch.