@@ -100,10 +100,10 @@ |
||
100 | 100 | |
101 | 101 | if ($opencount > 0) { |
102 | 102 | $this |
103 | - ->respondToSlack(' |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if ($userSession != null) { |
27 | 27 | Log::info('CP_SearchTDTicketJob: Found user session.'); |
28 | 28 | if ($userSession->td_token) { |
29 | - $TDinstance = new CP_TDinstance(env('TD_BEID'), env('TD_WEBSERVICESKEY'), env('TD_URLROOT'), env('TD_APPID'), $env, (string) $userSession->td_token); |
|
29 | + $TDinstance = new CP_TDinstance(env('TD_BEID'), env('TD_WEBSERVICESKEY'), env('TD_URLROOT'), env('TD_APPID'), $env, (string)$userSession->td_token); |
|
30 | 30 | Log::info('CP_SearchTDTicketJob: CP_TDinstance initialized with existing JWT.'); |
31 | 31 | } else { |
32 | 32 | $TDinstance = new CP_TDinstance(env('TD_BEID'), env('TD_WEBSERVICESKEY'), env('TD_URLROOT'), env('TD_APPID'), $env); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($ticket['StatusName'] != 'Closed' && $ticket['StatusName'] != 'Cancelled') { |
74 | 74 | $opencount++; |
75 | 75 | $date = date('F jS, Y', strtotime($ticket['CreatedDate'])); |
76 | - $ticketURL = (string) $TDinstance->rootAppsUrl().'Tickets/TicketDet?TicketID='.$ticket['ID']; |
|
76 | + $ticketURL = (string)$TDinstance->rootAppsUrl() . 'Tickets/TicketDet?TicketID=' . $ticket['ID']; |
|
77 | 77 | $ticketDescription = $TDinstance->ticket($ticket['ID']); //Need to do this because in the TD API, searched ticket's desctiption is empty. |
78 | 78 | |
79 | 79 | $attachmentFields[] = AttachmentField::create('Opened On', $date); |
@@ -86,36 +86,36 @@ discard block |
||
86 | 86 | |
87 | 87 | $action = $attachmentAction->toArray(); |
88 | 88 | $ticketattachments[] = Attachment::create() |
89 | - ->setFallback('Ticket '.$ticket['ID']) |
|
90 | - ->setTitle(' |
@@ -86,17 +86,17 @@ |
||
86 | 86 | $attachmentFields[] = AttachmentField::create('Date Opened', $date)->displaySideBySide(); |
87 | 87 | |
88 | 88 | $this |
89 | - ->respondToSlack(" |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if ($userSession != null) { |
27 | 27 | Log::info('CP_ShowTDTicketJob: Found user session.'); |
28 | 28 | if ($userSession->td_token) { |
29 | - $TDinstance = new CP_TDinstance(env('TD_BEID'), env('TD_WEBSERVICESKEY'), env('TD_URLROOT'), env('TD_APPID'), $env, (string) $userSession->td_token); |
|
29 | + $TDinstance = new CP_TDinstance(env('TD_BEID'), env('TD_WEBSERVICESKEY'), env('TD_URLROOT'), env('TD_APPID'), $env, (string)$userSession->td_token); |
|
30 | 30 | Log::info('CP_ShowTDTicketJob: CP_TDinstance initialized with existing JWT.'); |
31 | 31 | } else { |
32 | 32 | $TDinstance = new CP_TDinstance(env('TD_BEID'), env('TD_WEBSERVICESKEY'), env('TD_URLROOT'), env('TD_APPID'), $env); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | if ($ticket && $auth) { |
65 | 65 | $date = date('F jS, Y', strtotime($ticket['CreatedDate'])); |
66 | - $ticketURL = (string) $TDinstance->rootAppsUrl().'Tickets/TicketDet?TicketID='.$ticket['ID']; |
|
66 | + $ticketURL = (string)$TDinstance->rootAppsUrl() . 'Tickets/TicketDet?TicketID=' . $ticket['ID']; |
|
67 | 67 | $assets = $TDinstance->searchAssets($ticket['ID']); |
68 | 68 | $assetnames = 'No Assets'; |
69 | 69 | $userSession->increment('td_tickets'); |
@@ -71,18 +71,18 @@ discard block |
||
71 | 71 | if (count($assets)) { |
72 | 72 | $assetnames = ''; |
73 | 73 | foreach ($assets as $asset) { |
74 | - $assetnames = $assetnames.$asset['Name'].', '; |
|
74 | + $assetnames = $assetnames . $asset['Name'] . ', '; |
|
75 | 75 | } |
76 | 76 | $assetnames = substr($assetnames, 0, -2); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $attachmentFields[] = AttachmentField::create('Description', $ticket['Description']); |
80 | - $attachmentFields[] = AttachmentField::create('Requestor', $ticket['RequestorName']."\n".$ticket['RequestorEmail']."\n".$ticket['RequestorPhone'])->displaySideBySide(); |
|
81 | - $attachmentFields[] = AttachmentField::create('Location', $ticket['LocationName']."\n".$ticket['LocationRoomName'])->displaySideBySide(); |
|
80 | + $attachmentFields[] = AttachmentField::create('Requestor', $ticket['RequestorName'] . "\n" . $ticket['RequestorEmail'] . "\n" . $ticket['RequestorPhone'])->displaySideBySide(); |
|
81 | + $attachmentFields[] = AttachmentField::create('Location', $ticket['LocationName'] . "\n" . $ticket['LocationRoomName'])->displaySideBySide(); |
|
82 | 82 | $attachmentFields[] = AttachmentField::create('Service', $ticket['ServiceName'])->displaySideBySide(); |
83 | 83 | $attachmentFields[] = AttachmentField::create('Status', $ticket['StatusName'])->displaySideBySide(); |
84 | 84 | $attachmentFields[] = AttachmentField::create('Assets', $assetnames)->displaySideBySide(); |
85 | - $attachmentFields[] = AttachmentField::create('Assigned To', $ticket['ResponsibleFullName']."\n".$ticket['ResponsibleEmail'])->displaySideBySide(); |
|
85 | + $attachmentFields[] = AttachmentField::create('Assigned To', $ticket['ResponsibleFullName'] . "\n" . $ticket['ResponsibleEmail'])->displaySideBySide(); |
|
86 | 86 | $attachmentFields[] = AttachmentField::create('Date Opened', $date)->displaySideBySide(); |
87 | 87 | |
88 | 88 | $this |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | ->setTitle("{$ticket['Title']}") |
94 | 94 | ->setTitleLink("{$ticketURL}") |
95 | 95 | ->setFields($attachmentFields) |
96 | - ->setFooter('CP_TD/S API bot microservice v'.$TDinstance->getVersion().' | Build: '.$build) |
|
96 | + ->setFooter('CP_TD/S API bot microservice v' . $TDinstance->getVersion() . ' | Build: ' . $build) |
|
97 | 97 | ) |
98 | 98 | ->displayResponseToEveryoneOnChannel() |
99 | 99 | ->send(); |
@@ -21,9 +21,9 @@ |
||
21 | 21 | public function canHandle(Request $request): bool |
22 | 22 | { |
23 | 23 | Log::info('CP_ShowTDTicket: canHandle method called.'); |
24 | - Log::info('CP_ShowTDTicket: Request type is '.gettype($request).'.'); |
|
24 | + Log::info('CP_ShowTDTicket: Request type is ' . gettype($request) . '.'); |
|
25 | 25 | if ($request->command) { |
26 | - Log::info('CP_ShowTDTicket: Given command '.$request->command.'.'); |
|
26 | + Log::info('CP_ShowTDTicket: Given command ' . $request->command . '.'); |
|
27 | 27 | if ($request->text == 'help' || $request->text == 'Help') { |
28 | 28 | Log::info('CP_ShowTDTicket: User is requesting help. Stepping aside.'); |
29 | 29 |
@@ -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 given data.'); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function boot() |
16 | 16 | { |
17 | 17 | //Fix Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes |
18 | - // Schema::defaultStringLength(191); |
|
18 | + // Schema::defaultStringLength(191); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $a = func_get_args(); |
21 | 21 | $i = func_num_args(); |
22 | - if (method_exists($this, $f = '__construct'.$i)) { |
|
22 | + if (method_exists($this, $f = '__construct' . $i)) { |
|
23 | 23 | call_user_func_array([$this, $f], $a); |
24 | 24 | } |
25 | 25 | } |
@@ -53,27 +53,27 @@ discard block |
||
53 | 53 | list($JWTheader, $JWTpayload, $JWTsig) = explode('.', $a); |
54 | 54 | $this->auth = $a; |
55 | 55 | $this->expires = json_decode(base64_decode($JWTpayload))->exp; |
56 | - $this->authstring = 'Authorization: Bearer '.$this->auth; |
|
56 | + $this->authstring = 'Authorization: Bearer ' . $this->auth; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | private function setEnv($e, $u) |
60 | 60 | { |
61 | 61 | if ($e == 'prod') { |
62 | 62 | Log::info('CP_TDauth: Setup for production.'); |
63 | - $this->urlroot = $u.'TDWebApi/api/'; |
|
64 | - $this->appsroot = $u.'TDNext/Apps/'; |
|
63 | + $this->urlroot = $u . 'TDWebApi/api/'; |
|
64 | + $this->appsroot = $u . 'TDNext/Apps/'; |
|
65 | 65 | } elseif ($e == 'sandbox') { |
66 | 66 | Log::info('CP_TDauth: Setup for sandbox.'); |
67 | - $this->urlroot = $u.'SBTDWebApi/api/'; |
|
68 | - $this->appsroot = $u.'SBTDNext/Apps/'; |
|
67 | + $this->urlroot = $u . 'SBTDWebApi/api/'; |
|
68 | + $this->appsroot = $u . 'SBTDNext/Apps/'; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | 72 | private function authorize($b, $w, $u) |
73 | 73 | { |
74 | 74 | Log::info('CP_TDauth: authorize method called.'); |
75 | - Log::info('CP_TDauth: authorize requesting at ['.$u.'auth/loginadmin].'); |
|
76 | - $ch = curl_init($u.'auth/loginadmin'); |
|
75 | + Log::info('CP_TDauth: authorize requesting at [' . $u . 'auth/loginadmin].'); |
|
76 | + $ch = curl_init($u . 'auth/loginadmin'); |
|
77 | 77 | $payload = json_encode(['BEID' => $b, 'WebServicesKey' => $w]); |
78 | 78 | curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); |
79 | 79 | curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json']); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | list($JWTheader, $JWTpayload, $JWTsig) = explode('.', $bearer); |
88 | 88 | $this->auth = $bearer; |
89 | 89 | $this->expires = json_decode(base64_decode($JWTpayload))->exp; |
90 | - $this->authstring = 'Authorization: Bearer '.$this->auth; |
|
90 | + $this->authstring = 'Authorization: Bearer ' . $this->auth; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | Log::info('CP_TDauth: Token was expired. Replaced with new token.'); |
101 | 101 | } else { |
102 | 102 | $remain = $this->expires - time(); |
103 | - Log::info('CP_TDauth: Token ok, time remaining: '.$remain); |
|
103 | + Log::info('CP_TDauth: Token ok, time remaining: ' . $remain); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return true; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | Log::info('CP_TDinstance: connect method called.'); |
136 | 136 | $this->checkToken(); |
137 | - $ch = curl_init($this->urlroot.$point); |
|
137 | + $ch = curl_init($this->urlroot . $point); |
|
138 | 138 | curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json', $this->authstring]); |
139 | 139 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
140 | 140 | if ($type == 'post') { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $check = substr($r, -3); |
156 | 156 | if (substr($check, 1, 1) == '-') { |
157 | 157 | $flag = substr($check, 1, 2); |
158 | - Log::info('CP_TDinstance: flagCheck given flag '.$flag); |
|
158 | + Log::info('CP_TDinstance: flagCheck given flag ' . $flag); |
|
159 | 159 | |
160 | 160 | return $flag; |
161 | 161 | } else { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | public function ticket($ticketno) |
167 | 167 | { |
168 | 168 | Log::info('CP_TDinstance: ticket method called.'); |
169 | - $ticket = $this->connect('get', $this->appid.'/tickets/'.$ticketno, ''); |
|
169 | + $ticket = $this->connect('get', $this->appid . '/tickets/' . $ticketno, ''); |
|
170 | 170 | |
171 | 171 | return $ticket; |
172 | 172 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | if ($flag = '-r') { |
193 | 193 | $data = ['RequestorNameSearch' => substr($search, 0, -3)]; |
194 | 194 | $data_string = json_encode($data); |
195 | - $tickets = $this->connect('post', $this->appid.'/tickets/search', $data_string); |
|
195 | + $tickets = $this->connect('post', $this->appid . '/tickets/search', $data_string); |
|
196 | 196 | |
197 | 197 | return $tickets; |
198 | 198 | } else { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | public function searchAssets($search) |
215 | 215 | { |
216 | 216 | Log::info('CP_TDinstance: searchAssets method called.'); |
217 | - $ticketids = [(int) $search]; |
|
217 | + $ticketids = [(int)$search]; |
|
218 | 218 | $data = ['TicketIDs' => $ticketids]; |
219 | 219 | $data_string = json_encode($data); |
220 | 220 | $assets = $this->connect('post', 'assets/search', $data_string); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | Log::info('CP_TDinstance: searchResponsibility method called.'); |
228 | 228 | if (!is_array($search)) { |
229 | - $search = [(string) $search]; |
|
229 | + $search = [(string)$search]; |
|
230 | 230 | } |
231 | 231 | $ResponsibilityUids = $search; |
232 | 232 | $data = ['ResponsibilityUids' => $ResponsibilityUids]; |
@@ -240,6 +240,6 @@ discard block |
||
240 | 240 | { |
241 | 241 | Log::info('CP_TDinstance: rootAppsUrl method called.'); |
242 | 242 | |
243 | - return $this->appsroot.$this->appid.'/'; |
|
243 | + return $this->appsroot . $this->appid . '/'; |
|
244 | 244 | } |
245 | 245 | } |