Completed
Push — master ( 45e4b7...6d9e41 )
by Chris
04:14 queued 01:51
created
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
         $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
 block discarded – undo
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
 block discarded – undo
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
 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
         }
99 99
     }
100 100
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 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/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/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   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
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
 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.