GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Branch master (c188f7)
by Romain
05:38
created
src/Strime/Slackify/Webhooks/Webhook.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             // Create an array with the valid values
74 74
             $valid_values = explode(",", self::SLACK_VALID_VALUES);
75 75
 
76
-            if(!in_array($key, $valid_values)) {
76
+            if (!in_array($key, $valid_values)) {
77 77
                 unset($values[$key]);
78 78
             }
79 79
             else {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         }
89 89
 
90 90
         // Check if a message has been defined
91
-        if(!isset($values["message"])) {
91
+        if (!isset($values["message"])) {
92 92
             throw new InvalidArgumentException("The message value is missing.");
93 93
         }
94 94
 
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
         $values["message"] = str_replace('>', '>', $values["message"]);
99 99
 
100 100
         // Add the link to the message if needed.
101
-        if(isset($values["link"]) && ($values["link"] !== NULL)) {
101
+        if (isset($values["link"]) && ($values["link"] !== NULL)) {
102 102
             $values["message"] .= "\n";
103
-            $values["message"] .=  "<" . $values["link"]; 
104
-            if(isset($values["link_text"]) && ($values["link_text"] !== NULL)) {
105
-                $values["message"] .=  "|" . $values["link_text"];
103
+            $values["message"] .= "<" . $values["link"]; 
104
+            if (isset($values["link_text"]) && ($values["link_text"] !== NULL)) {
105
+                $values["message"] .= "|" . $values["link_text"];
106 106
             }
107
-            $values["message"] .=  ">" ;
107
+            $values["message"] .= ">";
108 108
         }
109 109
 
110 110
         // Set the parameters for the request
@@ -112,32 +112,32 @@  discard block
 block discarded – undo
112 112
             "text" => $values["message"]
113 113
         );
114 114
 
115
-        if(isset($values["channel"]) && ($values["channel"] !== NULL)) {
115
+        if (isset($values["channel"]) && ($values["channel"] !== NULL)) {
116 116
             $params["channel"] = $values["channel"];
117 117
         }
118 118
 
119
-        if(isset($values["icon"]) && ($values["icon"] !== NULL)) {
119
+        if (isset($values["icon"]) && ($values["icon"] !== NULL)) {
120 120
 
121 121
             // The icon may either be a URL or an emoji
122 122
             // We need to check the form of the string to know which parameter to choose.
123 123
             $icon_type = NULL;
124 124
 
125
-            if((strcmp(substr($values["icon"], 0, 1), ":") == 0) && (strcmp(substr($values["icon"], -1), ":") == 0)) {
125
+            if ((strcmp(substr($values["icon"], 0, 1), ":") == 0) && (strcmp(substr($values["icon"], -1), ":") == 0)) {
126 126
                 $icon_type = "emoji";
127 127
             }
128 128
             else {
129 129
                 $icon_type = "url";
130 130
             }
131 131
 
132
-            $params["icon_".$icon_type] = $values["icon"];
132
+            $params["icon_" . $icon_type] = $values["icon"];
133 133
         }
134 134
 
135
-        if(isset($values["username"]) && ($values["username"] !== NULL)) {
135
+        if (isset($values["username"]) && ($values["username"] !== NULL)) {
136 136
             $params["username"] = $values["username"];
137 137
         }
138 138
 
139 139
         // Check if there are attachments to add to the request
140
-        if(is_array($this->attachments) && (count($this->attachments) > 0)) {
140
+        if (is_array($this->attachments) && (count($this->attachments) > 0)) {
141 141
             $params["attachments"] = $this->attachments;
142 142
         }
143 143
 
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
         try {
146 146
             $client = new \GuzzleHttp\Client();
147 147
             $json_response = $client->request('POST', $this->url, [
148
-                'body' => json_encode( $params )
148
+                'body' => json_encode($params)
149 149
             ]);
150 150
             $curl_status = $json_response->getStatusCode();
151
-            $response = json_decode( $json_response->getBody() );
151
+            $response = json_decode($json_response->getBody());
152 152
         }
153
-        catch(RequestException $e) {
154
-            throw new RuntimeException('The request to the webhook failed: '.$e->getMessage(), $e->getCode(), $e);
153
+        catch (RequestException $e) {
154
+            throw new RuntimeException('The request to the webhook failed: ' . $e->getMessage(), $e->getCode(), $e);
155 155
         }
156 156
 
157 157
         // We re-initialize the attachments to prevent any conflict with a future message.
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
             // Create an array with the valid values
181 181
             $valid_values = explode(",", self::SLACK_VALID_ATTACHMENTS);
182 182
 
183
-            if(!in_array($key, $valid_values)) {
183
+            if (!in_array($key, $valid_values)) {
184 184
                 unset($attachments[$key]);
185 185
             }
186 186
         }
187 187
 
188 188
         // Check if a message has been defined
189
-        if(!isset($attachments["fallback"], $attachments["fields"], $attachments["fields"]["title"])) {
189
+        if (!isset($attachments["fallback"], $attachments["fields"], $attachments["fields"]["title"])) {
190 190
             throw new InvalidArgumentException("Attachment fields are missing.");
191 191
         }
192 192
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
             if(!in_array($key, $valid_values)) {
77 77
                 unset($values[$key]);
78
-            }
79
-            else {
78
+            } else {
80 79
                 switch ($key) {
81 80
                     default:
82 81
                         if (!is_string($value)) {
@@ -124,8 +123,7 @@  discard block
 block discarded – undo
124 123
 
125 124
             if((strcmp(substr($values["icon"], 0, 1), ":") == 0) && (strcmp(substr($values["icon"], -1), ":") == 0)) {
126 125
                 $icon_type = "emoji";
127
-            }
128
-            else {
126
+            } else {
129 127
                 $icon_type = "url";
130 128
             }
131 129
 
@@ -149,8 +147,7 @@  discard block
 block discarded – undo
149 147
             ]);
150 148
             $curl_status = $json_response->getStatusCode();
151 149
             $response = json_decode( $json_response->getBody() );
152
-        }
153
-        catch(RequestException $e) {
150
+        } catch(RequestException $e) {
154 151
             throw new RuntimeException('The request to the webhook failed: '.$e->getMessage(), $e->getCode(), $e);
155 152
         }
156 153
 
Please login to merge, or discard this patch.