Completed
Pull Request — master (#28)
by
unknown
02:57
created
php/Requests/AbstractRequest.php 1 patch
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
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
     const SECRET = 'hyTBJcvtpDLSgGUWjybbYUNKSSoVvMcfdjtjiQvf';
@@ -20,7 +20,8 @@  discard block
 block discarded – undo
20 20
 		        
21 21
 		$this->payLoad = $this->getPayload();
22 22
 		$device_uid = '';
23
-		if(isset($this->payLoad['device_uid'])) {
23
+		if(isset($this->payLoad['device_uid']))
24
+		{
24 25
 			$device_uid = $this->payLoad['device_uid'];
25 26
 		}
26 27
 				
@@ -29,7 +30,8 @@  discard block
 block discarded – undo
29 30
         $header = $this->getSignHeaders();
30 31
         $url = $this->getFullUrl();
31 32
 
32
-        if ($this->getAccessToken()) {
33
+        if ($this->getAccessToken())
34
+        {
33 35
             $header['Authorization'] = "Bearer " . $this->getAccessToken();
34 36
         }
35 37
         //Comment out to debug the Request:
@@ -52,7 +54,8 @@  discard block
 block discarded – undo
52 54
             'proxy' => '186.103.169.165:8080',
53 55
         );*/
54 56
 
55
-        switch ($this->getMethod()) {
57
+        switch ($this->getMethod())
58
+        {
56 59
             case 'POST':
57 60
                 $result = Requests::post($url, $header, $this->payLoad);
58 61
                 break;
@@ -73,7 +76,8 @@  discard block
 block discarded – undo
73 76
 
74 77
         http_response_code($result->status_code);
75 78
 
76
-        switch ($result->status_code) {
79
+        switch ($result->status_code)
80
+        {
77 81
             case 200:
78 82
                 $result = json_decode($result->body, true);
79 83
                 break;
@@ -173,10 +177,12 @@  discard block
 block discarded – undo
173 177
      */
174 178
     private function getSignHeaders()
175 179
     {
176
-			if($this->getAccessToken() == null) {
180
+			if($this->getAccessToken() == null)
181
+			{
177 182
 				$payload_accessToken = "";
178 183
 			}
179
-			else {
184
+			else
185
+			{
180 186
 				$payload_accessToken = $this->getAccessToken();
181 187
 			}
182 188
 			
Please login to merge, or discard this patch.