@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $method = isset($options['method']) ? $options['method'] : 'GET'; |
| 36 | 36 | $query = isset($options['query']) |
| 37 | - ? array_filter($options['query'], function ($x) { |
|
| 37 | + ? array_filter($options['query'], function($x) { |
|
| 38 | 38 | return !is_null($x); |
| 39 | 39 | }) : []; |
| 40 | 40 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $ch = curl_init(); |
| 58 | 58 | |
| 59 | 59 | $url = isset($options['url']) |
| 60 | - ? $options['url'] . '?' . http_build_query(array_merge( |
|
| 60 | + ? $options['url'].'?'.http_build_query(array_merge( |
|
| 61 | 61 | $query, |
| 62 | 62 | ['api_key' => self::getApiKey()] |
| 63 | 63 | )) : ''; |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | curl_setopt_array($ch, $curlOpts); |
| 78 | 78 | |
| 79 | - if (null != $file) { |
|
| 79 | + if (null!=$file) { |
|
| 80 | 80 | $cfile = new \CURLFile($file, '', ''); |
| 81 | - $body['strFilename']=$cfile; |
|
| 81 | + $body['strFilename'] = $cfile; |
|
| 82 | 82 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 83 | 83 | curl_setopt($ch, CURLOPT_POST, true); |
| 84 | 84 | curl_setopt($ch, CURLOPT_POSTFIELDS, $body); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (isset($body)) { |
| 99 | 99 | $bodyData = json_encode($body); |
| 100 | 100 | if (isset($options['HTTPHEADER'])) { |
| 101 | - if (strpos($options['HTTPHEADER'], 'multipart/form-data') > 0) { |
|
| 101 | + if (strpos($options['HTTPHEADER'], 'multipart/form-data')>0) { |
|
| 102 | 102 | $bodyData = $body; |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -123,14 +123,14 @@ discard block |
||
| 123 | 123 | curl_close($ch); |
| 124 | 124 | |
| 125 | 125 | $json = null; |
| 126 | - if (strpos($result, '<?xml') > -1) { |
|
| 126 | + if (strpos($result, '<?xml')>-1) { |
|
| 127 | 127 | $xml = simplexml_load_string($result); |
| 128 | 128 | $json = self::object2array($xml); |
| 129 | 129 | } else { |
| 130 | 130 | $json = json_decode($result, true); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if (200 == $code) { |
|
| 133 | + if (200==$code) { |
|
| 134 | 134 | if (isset($json['errors'])) { |
| 135 | 135 | throw new ApiError(implode(', ', $json['errors']), $code, $result); |
| 136 | 136 | } else { |
@@ -142,16 +142,16 @@ discard block |
||
| 142 | 142 | if (isset($json['messages'])) { |
| 143 | 143 | $msg = ''; |
| 144 | 144 | foreach ($json['messages'] as $key => $value) { |
| 145 | - if ($msg !== '') { |
|
| 145 | + if ($msg!=='') { |
|
| 146 | 146 | $msg .= PHP_EOL; |
| 147 | 147 | } |
| 148 | - $msg .= $key . ': ' . implode(', ', $value); |
|
| 148 | + $msg .= $key.': '.implode(', ', $value); |
|
| 149 | 149 | } |
| 150 | 150 | throw new ApiError($msg, $code, $result); |
| 151 | 151 | } elseif (isset($json['errors'])) { |
| 152 | 152 | $msg = ''; |
| 153 | 153 | foreach ($json['errors'] as $key => $value) { |
| 154 | - if ($msg !== '') { |
|
| 154 | + if ($msg!=='') { |
|
| 155 | 155 | $msg .= PHP_EOL; |
| 156 | 156 | } |
| 157 | 157 | $msg .= $value; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | if (is_object($result1)) { |
| 197 | 197 | if ($deepPrinting) { |
| 198 | 198 | echo "<br>$key1 ------><br>"; |
| 199 | - $oarray = (array) $result1; |
|
| 199 | + $oarray = (array)$result1; |
|
| 200 | 200 | self::simplePrint($oarray, true); |
| 201 | 201 | echo '------<br>'; |
| 202 | 202 | } else { |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | if (is_object($result)) { |
| 214 | 214 | if ($deepPrinting) { |
| 215 | 215 | echo "<br>$key ------><br>"; |
| 216 | - $oarray = (array) $result; |
|
| 216 | + $oarray = (array)$result; |
|
| 217 | 217 | self::simplePrint($oarray, true); |
| 218 | 218 | echo '------<br>'; |
| 219 | 219 | } else { |