Passed
Branch tests (1701da)
by Chris
02:51
created
app/SlashCommandHandlers/Jobs/ShowTDTicketJob.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,17 +53,17 @@
 block discarded – undo
53 53
             $attachmentFields[] = AttachmentField::create('Date Opened', $date)->displaySideBySide();
54 54
 
55 55
             $this
56
-               ->respondToSlack("
Please login to merge, or discard this patch.
app/SessionManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/CP_TDinstance.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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']);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
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
             $this->header = $JWTheader;
99 99
             $this->authsig = $JWTsig;
100 100
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/SlashCommandHandlers/Jobs/SearchTDTicketJob.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -68,10 +68,10 @@
 block discarded – undo
68 68
 
69 69
         if ($opencount > 0) {
70 70
             $this
71
-             ->respondToSlack('
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,36 +54,36 @@
 block discarded – undo
54 54
 
55 55
                 $action = $attachmentAction->toArray();
56 56
                 $ticketattachments[] = Attachment::create()
57
-                ->setFallback('Ticket '.$ticket['ID'])
58
-                ->setTitle('
Please login to merge, or discard this patch.