@@ -34,13 +34,17 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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) { |