@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | abstract class AbstractRequest |
| 4 | -{ |
|
| 4 | +{ |
|
| 5 | 5 | const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
| 6 | 6 | const APIURL = 'https://api.go-tellm.com/api'; |
| 7 | 7 | |
@@ -21,7 +21,8 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | $this->payLoad = $this->getPayload(); |
| 23 | 23 | $device_uid = ''; |
| 24 | - if(isset($this->payLoad['device_uid'])) { |
|
| 24 | + if(isset($this->payLoad['device_uid'])) |
|
| 25 | + { |
|
| 25 | 26 | $device_uid = $this->payLoad['device_uid']; |
| 26 | 27 | } |
| 27 | 28 | |
@@ -30,7 +31,8 @@ discard block |
||
| 30 | 31 | $header = $this->getSignHeaders(); |
| 31 | 32 | $url = $this->getFullUrl(); |
| 32 | 33 | |
| 33 | - if ($this->getAccessToken()) { |
|
| 34 | + if ($this->getAccessToken()) |
|
| 35 | + { |
|
| 34 | 36 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
| 35 | 37 | } |
| 36 | 38 | //Comment out to debug the Request: |
@@ -53,7 +55,8 @@ discard block |
||
| 53 | 55 | 'proxy' => '186.103.169.165:8080', |
| 54 | 56 | );*/ |
| 55 | 57 | |
| 56 | - switch ($this->getMethod()) { |
|
| 58 | + switch ($this->getMethod()) |
|
| 59 | + { |
|
| 57 | 60 | case 'POST': |
| 58 | 61 | $result = Requests::post($url, $header, $this->payLoad); |
| 59 | 62 | break; |
@@ -74,7 +77,8 @@ discard block |
||
| 74 | 77 | |
| 75 | 78 | http_response_code($result->status_code); |
| 76 | 79 | |
| 77 | - switch ($result->status_code) { |
|
| 80 | + switch ($result->status_code) |
|
| 81 | + { |
|
| 78 | 82 | case 200: |
| 79 | 83 | $result = json_decode($result->body, true); |
| 80 | 84 | break; |
@@ -174,10 +178,12 @@ discard block |
||
| 174 | 178 | */ |
| 175 | 179 | private function getSignHeaders() |
| 176 | 180 | { |
| 177 | - if($this->getAccessToken() == null) { |
|
| 181 | + if($this->getAccessToken() == null) |
|
| 182 | + { |
|
| 178 | 183 | $payload_accessToken = ""; |
| 179 | 184 | } |
| 180 | - else { |
|
| 185 | + else |
|
| 186 | + { |
|
| 181 | 187 | $payload_accessToken = $this->getAccessToken(); |
| 182 | 188 | } |
| 183 | 189 | |