@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | protected function mapWebRoutes() |
53 | 53 | { |
54 | 54 | Route::middleware('web') |
55 | - ->namespace($this->namespace) |
|
56 | - ->group(base_path('routes/web.php')); |
|
55 | + ->namespace($this->namespace) |
|
56 | + ->group(base_path('routes/web.php')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | protected function mapApiRoutes() |
67 | 67 | { |
68 | 68 | Route::prefix('api') |
69 | - ->middleware('api') |
|
70 | - ->namespace($this->namespace) |
|
71 | - ->group(base_path('routes/api.php')); |
|
69 | + ->middleware('api') |
|
70 | + ->namespace($this->namespace) |
|
71 | + ->group(base_path('routes/api.php')); |
|
72 | 72 | } |
73 | 73 | } |
@@ -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 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | if ($ticket && $auth) { |
32 | 32 | $date = date('F jS, Y', strtotime($ticket['CreatedDate'])); |
33 | - $ticketURL = (string) $TDinstance->rootAppsUrl().'Tickets/TicketDet?TicketID='.$ticket['ID']; |
|
33 | + $ticketURL = (string)$TDinstance->rootAppsUrl() . 'Tickets/TicketDet?TicketID=' . $ticket['ID']; |
|
34 | 34 | $assets = $TDinstance->searchAssets($ticket['ID']); |
35 | 35 | $assetnames = 'No Assets'; |
36 | 36 | $userSession()->increment('td_tickets'); |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | if (count($assets)) { |
39 | 39 | $assetnames = ''; |
40 | 40 | foreach ($assets as $asset) { |
41 | - $assetnames = $assetnames.$asset['Name'].', '; |
|
41 | + $assetnames = $assetnames . $asset['Name'] . ', '; |
|
42 | 42 | } |
43 | 43 | $assetnames = substr($assetnames, 0, -2); |
44 | 44 | } |
45 | 45 | |
46 | 46 | $attachmentFields[] = AttachmentField::create('Description', $ticket['Description']); |
47 | - $attachmentFields[] = AttachmentField::create('Requestor', $ticket['RequestorName']."\n".$ticket['RequestorEmail']."\n".$ticket['RequestorPhone'])->displaySideBySide(); |
|
48 | - $attachmentFields[] = AttachmentField::create('Location', $ticket['LocationName']."\n".$ticket['LocationRoomName'])->displaySideBySide(); |
|
47 | + $attachmentFields[] = AttachmentField::create('Requestor', $ticket['RequestorName'] . "\n" . $ticket['RequestorEmail'] . "\n" . $ticket['RequestorPhone'])->displaySideBySide(); |
|
48 | + $attachmentFields[] = AttachmentField::create('Location', $ticket['LocationName'] . "\n" . $ticket['LocationRoomName'])->displaySideBySide(); |
|
49 | 49 | $attachmentFields[] = AttachmentField::create('Service', $ticket['ServiceName'])->displaySideBySide(); |
50 | 50 | $attachmentFields[] = AttachmentField::create('Status', $ticket['StatusName'])->displaySideBySide(); |
51 | 51 | $attachmentFields[] = AttachmentField::create('Assets', $assetnames)->displaySideBySide(); |
52 | - $attachmentFields[] = AttachmentField::create('Assigned To', $ticket['ResponsibleFullName']."\n".$ticket['ResponsibleEmail'])->displaySideBySide(); |
|
52 | + $attachmentFields[] = AttachmentField::create('Assigned To', $ticket['ResponsibleFullName'] . "\n" . $ticket['ResponsibleEmail'])->displaySideBySide(); |
|
53 | 53 | $attachmentFields[] = AttachmentField::create('Date Opened', $date)->displaySideBySide(); |
54 | 54 | |
55 | 55 | $this |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | ->setTitle("{$ticket['Title']}") |
61 | 61 | ->setTitleLink("{$ticketURL}") |
62 | 62 | ->setFields($attachmentFields) |
63 | - ->setFooter('CP_TD/S API bot microservice v'.$TDinstance->getVersion().' | Build: '.$build) |
|
63 | + ->setFooter('CP_TD/S API bot microservice v' . $TDinstance->getVersion() . ' | Build: ' . $build) |
|
64 | 64 | ) |
65 | 65 | ->displayResponseToEveryoneOnChannel() |
66 | 66 | ->send(); |
@@ -53,17 +53,17 @@ |
||
53 | 53 | $attachmentFields[] = AttachmentField::create('Date Opened', $date)->displaySideBySide(); |
54 | 54 | |
55 | 55 | $this |
56 | - ->respondToSlack(" |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $a = func_get_args(); |
23 | 23 | $i = func_num_args(); |
24 | - if (method_exists($this, $f = '__construct'.$i)) { |
|
24 | + if (method_exists($this, $f = '__construct' . $i)) { |
|
25 | 25 | call_user_func_array([$this, $f], $a); |
26 | 26 | } |
27 | 27 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | list($JWTheader, $JWTpayload, $JWTsig) = $parts; |
55 | 55 | $this->auth = $a; |
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 ($e == 'prod') { |
69 | 69 | Log::info('CP_TDauth: Setup for production.'); |
70 | - $this->urlroot = $u.'TDWebApi/api/'; |
|
71 | - $this->appsroot = $u.'TDNext/Apps/'; |
|
70 | + $this->urlroot = $u . 'TDWebApi/api/'; |
|
71 | + $this->appsroot = $u . 'TDNext/Apps/'; |
|
72 | 72 | } elseif ($e == 'sandbox') { |
73 | 73 | Log::info('CP_TDauth: Setup for sandbox.'); |
74 | - $this->urlroot = $u.'SBTDWebApi/api/'; |
|
75 | - $this->appsroot = $u.'SBTDNext/Apps/'; |
|
74 | + $this->urlroot = $u . 'SBTDWebApi/api/'; |
|
75 | + $this->appsroot = $u . 'SBTDNext/Apps/'; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | 79 | private function authorize($b, $w, $u) |
80 | 80 | { |
81 | 81 | Log::info('CP_TDauth: authorize method called.'); |
82 | - Log::info('CP_TDauth: authorize requesting at ['.$u.'auth/loginadmin].'); |
|
83 | - $ch = curl_init($u.'auth/loginadmin'); |
|
82 | + Log::info('CP_TDauth: authorize requesting at [' . $u . 'auth/loginadmin].'); |
|
83 | + $ch = curl_init($u . 'auth/loginadmin'); |
|
84 | 84 | $payload = json_encode(['BEID' => $b, 'WebServicesKey' => $w]); |
85 | 85 | curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); |
86 | 86 | curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json']); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | list($JWTheader, $JWTpayload, $JWTsig) = explode('.', $bearer); |
95 | 95 | $this->auth = $bearer; |
96 | 96 | $this->expires = json_decode(base64_decode($JWTpayload))->exp; |
97 | - $this->authstring = 'Authorization: Bearer '.$this->auth; |
|
97 | + $this->authstring = 'Authorization: Bearer ' . $this->auth; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | Log::info('CP_TDauth: Token was expired. Replaced with new token.'); |
108 | 108 | } else { |
109 | 109 | $remain = $this->expires - time(); |
110 | - Log::info('CP_TDauth: Token ok, time remaining: '.$remain); |
|
110 | + Log::info('CP_TDauth: Token ok, time remaining: ' . $remain); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return true; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | Log::info('CP_TDinstance: connect method called.'); |
143 | 143 | $this->checkToken(); |
144 | - $ch = curl_init($this->urlroot.$point); |
|
144 | + $ch = curl_init($this->urlroot . $point); |
|
145 | 145 | curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json', $this->authstring]); |
146 | 146 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
147 | 147 | if ($type == 'post') { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $check = substr($r, -3); |
163 | 163 | if (substr($check, 1, 1) == '-') { |
164 | 164 | $flag = substr($check, 1, 2); |
165 | - Log::info('CP_TDinstance: flagCheck given flag '.$flag); |
|
165 | + Log::info('CP_TDinstance: flagCheck given flag ' . $flag); |
|
166 | 166 | |
167 | 167 | return $flag; |
168 | 168 | } else { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function ticket($ticketno) |
174 | 174 | { |
175 | 175 | Log::info('CP_TDinstance: ticket method called.'); |
176 | - $ticket = $this->connect('get', $this->appid.'/tickets/'.$ticketno, ''); |
|
176 | + $ticket = $this->connect('get', $this->appid . '/tickets/' . $ticketno, ''); |
|
177 | 177 | |
178 | 178 | return $ticket; |
179 | 179 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | if ($flag = '-r') { |
200 | 200 | $data = ['RequestorNameSearch' => substr($search, 0, -3)]; |
201 | 201 | $data_string = json_encode($data); |
202 | - $tickets = $this->connect('post', $this->appid.'/tickets/search', $data_string); |
|
202 | + $tickets = $this->connect('post', $this->appid . '/tickets/search', $data_string); |
|
203 | 203 | |
204 | 204 | return $tickets; |
205 | 205 | } else { |
@@ -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 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | if ($userSession != null) { |
28 | 28 | Log::info('CP_SessionManager: Found user session.'); |
29 | 29 | if ($userSession->td_token) { |
30 | - $TDinstance = new CP_TDinstance(env('TD_BEID'), env('TD_WEBSERVICESKEY'), env('TD_URLROOT'), env('TD_APPID'), $env, (string) $userSession->td_token); |
|
30 | + $TDinstance = new CP_TDinstance(env('TD_BEID'), env('TD_WEBSERVICESKEY'), env('TD_URLROOT'), env('TD_APPID'), $env, (string)$userSession->td_token); |
|
31 | 31 | Log::info('CP_SessionManager: CP_TDinstance initialized with existing JWT.'); |
32 | 32 | } else { |
33 | 33 | $TDinstance = new CP_TDinstance(env('TD_BEID'), env('TD_WEBSERVICESKEY'), env('TD_URLROOT'), env('TD_APPID'), $env); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $userSession = TDsession::where('s_user_id', $slackUID)->first(); |
82 | 82 | $sid = $userSession->id; |
83 | 83 | $userSession->delete(); |
84 | - Log::info('CP_SessionManager: Deleted session '.$sid.'.'); |
|
84 | + Log::info('CP_SessionManager: Deleted session ' . $sid . '.'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -68,10 +68,10 @@ |
||
68 | 68 | |
69 | 69 | if ($opencount > 0) { |
70 | 70 | $this |
71 | - ->respondToSlack(' |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | if ($ticket['StatusName'] != 'Closed' && $ticket['StatusName'] != 'Cancelled') { |
42 | 42 | $opencount++; |
43 | 43 | $date = date('F jS, Y', strtotime($ticket['CreatedDate'])); |
44 | - $ticketURL = (string) $TDinstance->rootAppsUrl().'Tickets/TicketDet?TicketID='.$ticket['ID']; |
|
44 | + $ticketURL = (string)$TDinstance->rootAppsUrl() . 'Tickets/TicketDet?TicketID=' . $ticket['ID']; |
|
45 | 45 | $ticketDescription = $TDinstance->ticket($ticket['ID']); //Need to do this because in the TD API, searched ticket's desctiption is empty. |
46 | 46 | |
47 | 47 | $attachmentFields[] = AttachmentField::create('Opened On', $date); |
@@ -54,36 +54,36 @@ discard block |
||
54 | 54 | |
55 | 55 | $action = $attachmentAction->toArray(); |
56 | 56 | $ticketattachments[] = Attachment::create() |
57 | - ->setFallback('Ticket '.$ticket['ID']) |
|
58 | - ->setTitle(' |