@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $args = func_get_args(); |
23 | 23 | $argcount = func_num_args(); |
24 | - if (method_exists($this, $func = '__construct'.$argcount)) { |
|
24 | + if (method_exists($this, $func = '__construct' . $argcount)) { |
|
25 | 25 | call_user_func_array([$this, $func], $args); |
26 | 26 | } |
27 | 27 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | list($JWTheader, $JWTpayload, $JWTsig) = $parts; |
55 | 55 | $this->auth = $auth; |
56 | 56 | $this->expires = json_decode(base64_decode($JWTpayload))->exp; |
57 | - $this->authstring = 'Authorization: Bearer '.$this->auth; |
|
57 | + $this->authstring = 'Authorization: Bearer ' . $this->auth; |
|
58 | 58 | $this->header = $JWTheader; |
59 | 59 | $this->authsig = $JWTsig; |
60 | 60 | |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | { |
68 | 68 | if ($env == 'prod') { |
69 | 69 | Log::info('CP_TDauth: Setup for production.'); |
70 | - $this->urlroot = $urlroot.'TDWebApi/api/'; |
|
71 | - $this->appsroot = $urlroot.'TDNext/Apps/'; |
|
70 | + $this->urlroot = $urlroot . 'TDWebApi/api/'; |
|
71 | + $this->appsroot = $urlroot . 'TDNext/Apps/'; |
|
72 | 72 | } elseif ($env == 'sandbox') { |
73 | 73 | Log::info('CP_TDauth: Setup for sandbox.'); |
74 | - $this->urlroot = $urlroot.'SBTDWebApi/api/'; |
|
75 | - $this->appsroot = $urlroot.'SBTDNext/Apps/'; |
|
74 | + $this->urlroot = $urlroot . 'SBTDWebApi/api/'; |
|
75 | + $this->appsroot = $urlroot . 'SBTDNext/Apps/'; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | 79 | private function authorize($beid, $wskey, $urlroot) |
80 | 80 | { |
81 | 81 | Log::info('CP_TDauth: authorize method called.'); |
82 | - Log::info('CP_TDauth: authorize requesting at ['.$urlroot.'auth/loginadmin].'); |
|
83 | - $ch = curl_init($urlroot.'auth/loginadmin'); |
|
82 | + Log::info('CP_TDauth: authorize requesting at [' . $urlroot . 'auth/loginadmin].'); |
|
83 | + $ch = curl_init($urlroot . 'auth/loginadmin'); |
|
84 | 84 | $payload = json_encode(['BEID' => $beid, 'WebServicesKey' => $wskey]); |
85 | 85 | curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); |
86 | 86 | curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json']); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | list($JWTheader, $JWTpayload, $JWTsig) = explode('.', $bearer); |
96 | 96 | $this->auth = $bearer; |
97 | 97 | $this->expires = json_decode(base64_decode($JWTpayload))->exp; |
98 | - $this->authstring = 'Authorization: Bearer '.$this->auth; |
|
98 | + $this->authstring = 'Authorization: Bearer ' . $this->auth; |
|
99 | 99 | $this->header = $JWTheader; |
100 | 100 | $this->authsig = $JWTsig; |
101 | 101 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | Log::info('CP_TDauth: Token was expired. Replaced with new token.'); |
110 | 110 | } else { |
111 | 111 | $remain = $this->expires - time(); |
112 | - Log::info('CP_TDauth: Token ok, time remaining: '.$remain); |
|
112 | + Log::info('CP_TDauth: Token ok, time remaining: ' . $remain); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return true; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | Log::info('CP_TDinstance: connect method called.'); |
145 | 145 | $this->checkToken(); |
146 | - $ch = curl_init($this->urlroot.$point); |
|
146 | + $ch = curl_init($this->urlroot . $point); |
|
147 | 147 | curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json', $this->authstring]); |
148 | 148 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
149 | 149 | if ($type == 'post') { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $check = substr($search, -3); |
165 | 165 | if (substr($check, 1, 1) == '-') { |
166 | 166 | $flag = substr($check, 1, 2); |
167 | - Log::info('CP_TDinstance: flagCheck given flag '.$flag); |
|
167 | + Log::info('CP_TDinstance: flagCheck given flag ' . $flag); |
|
168 | 168 | |
169 | 169 | return $flag; |
170 | 170 | } else { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | public function ticket($ticketno) |
176 | 176 | { |
177 | 177 | Log::info('CP_TDinstance: ticket method called.'); |
178 | - $ticket = $this->connect('get', $this->appid.'/tickets/'.$ticketno, ''); |
|
178 | + $ticket = $this->connect('get', $this->appid . '/tickets/' . $ticketno, ''); |
|
179 | 179 | |
180 | 180 | return $ticket; |
181 | 181 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | if ($flag == '-r') { |
202 | 202 | $data = ['RequestorNameSearch' => substr($search, 0, -3)]; |
203 | 203 | $data_string = json_encode($data); |
204 | - $tickets = $this->connect('post', $this->appid.'/tickets/search', $data_string); |
|
204 | + $tickets = $this->connect('post', $this->appid . '/tickets/search', $data_string); |
|
205 | 205 | |
206 | 206 | return $tickets; |
207 | 207 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | public function searchAssets($search) |
222 | 222 | { |
223 | 223 | Log::info('CP_TDinstance: searchAssets method called.'); |
224 | - $ticketids = [(int) $search]; |
|
224 | + $ticketids = [(int)$search]; |
|
225 | 225 | $data = ['TicketIDs' => $ticketids]; |
226 | 226 | $data_string = json_encode($data); |
227 | 227 | $assets = $this->connect('post', 'assets/search', $data_string); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | { |
234 | 234 | Log::info('CP_TDinstance: searchResponsibility method called.'); |
235 | 235 | if (!is_array($search)) { |
236 | - $search = [(string) $search]; |
|
236 | + $search = [(string)$search]; |
|
237 | 237 | } |
238 | 238 | $ResponsibilityUids = $search; |
239 | 239 | $data = ['ResponsibilityUids' => $ResponsibilityUids]; |
@@ -247,6 +247,6 @@ discard block |
||
247 | 247 | { |
248 | 248 | Log::info('CP_TDinstance: rootAppsUrl method called.'); |
249 | 249 | |
250 | - return $this->appsroot.$this->appid.'/'; |
|
250 | + return $this->appsroot . $this->appid . '/'; |
|
251 | 251 | } |
252 | 252 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public function processBtn(Request $request) |
12 | 12 | { |
13 | 13 | Log::info('CP_SlackButtonController: processBtn method called.'); |
14 | - Log::info('CP_SlackButtonController: Request type is '.gettype($request).'.'); |
|
14 | + Log::info('CP_SlackButtonController: Request type is ' . gettype($request) . '.'); |
|
15 | 15 | $data = json_decode($request['payload']); |
16 | 16 | if (!$data) { |
17 | 17 | Log::info('CP_SlackButtonController: Controller was called, but no data given.'); |