@@ -225,47 +225,47 @@ discard block |
||
225 | 225 | return php_sapi_name(); |
226 | 226 | } |
227 | 227 | |
228 | - /** |
|
229 | - * Returns the client IP address which originated this request. |
|
230 | - * Lifted and modified from SilverStripe 3's SS_HTTPRequest. |
|
231 | - * |
|
232 | - * @return string |
|
233 | - */ |
|
234 | - public function getIP() : string |
|
228 | + /** |
|
229 | + * Returns the client IP address which originated this request. |
|
230 | + * Lifted and modified from SilverStripe 3's SS_HTTPRequest. |
|
231 | + * |
|
232 | + * @return string |
|
233 | + */ |
|
234 | + public function getIP() : string |
|
235 | 235 | { |
236 | - $headerOverrideIP = null; |
|
236 | + $headerOverrideIP = null; |
|
237 | 237 | |
238 | - if (defined('TRUSTED_PROXY')) { |
|
239 | - $headers = (defined('SS_TRUSTED_PROXY_IP_HEADER')) ? |
|
238 | + if (defined('TRUSTED_PROXY')) { |
|
239 | + $headers = (defined('SS_TRUSTED_PROXY_IP_HEADER')) ? |
|
240 | 240 | [SS_TRUSTED_PROXY_IP_HEADER] : |
241 | 241 | null; |
242 | 242 | |
243 | - if(!$headers) { |
|
244 | - // Backwards compatible defaults |
|
245 | - $headers = ['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR']; |
|
246 | - } |
|
243 | + if(!$headers) { |
|
244 | + // Backwards compatible defaults |
|
245 | + $headers = ['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR']; |
|
246 | + } |
|
247 | 247 | |
248 | - foreach($headers as $header) { |
|
249 | - if(!empty($_SERVER[$header])) { |
|
250 | - $headerOverrideIP = $_SERVER[$header]; |
|
248 | + foreach($headers as $header) { |
|
249 | + if(!empty($_SERVER[$header])) { |
|
250 | + $headerOverrideIP = $_SERVER[$header]; |
|
251 | 251 | |
252 | - break; |
|
253 | - } |
|
254 | - } |
|
255 | - } |
|
252 | + break; |
|
253 | + } |
|
254 | + } |
|
255 | + } |
|
256 | 256 | |
257 | 257 | $proxy = Injector::inst()->create(TrustedProxyMiddleware::class); |
258 | 258 | |
259 | - if ($headerOverrideIP) { |
|
260 | - return $proxy->getIPFromHeaderValue($headerOverrideIP); |
|
261 | - } |
|
259 | + if ($headerOverrideIP) { |
|
260 | + return $proxy->getIPFromHeaderValue($headerOverrideIP); |
|
261 | + } |
|
262 | 262 | |
263 | 263 | if (isset($_SERVER['REMOTE_ADDR'])) { |
264 | - return $_SERVER['REMOTE_ADDR']; |
|
265 | - } |
|
264 | + return $_SERVER['REMOTE_ADDR']; |
|
265 | + } |
|
266 | 266 | |
267 | 267 | return ''; |
268 | - } |
|
268 | + } |
|
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Returns a default set of additional data specific to the user's part in |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | 'args' => [], |
322 | 322 | ]); |
323 | 323 | |
324 | - return Backtrace::filter_backtrace($bt, [ |
|
324 | + return Backtrace::filter_backtrace($bt, [ |
|
325 | 325 | '', |
326 | 326 | 'Monolog\\Handler\\AbstractProcessingHandler->handle', |
327 | 327 | 'Monolog\\Logger->addRecord', |
@@ -237,16 +237,15 @@ |
||
237 | 237 | |
238 | 238 | if (defined('TRUSTED_PROXY')) { |
239 | 239 | $headers = (defined('SS_TRUSTED_PROXY_IP_HEADER')) ? |
240 | - [SS_TRUSTED_PROXY_IP_HEADER] : |
|
241 | - null; |
|
240 | + [SS_TRUSTED_PROXY_IP_HEADER] : null; |
|
242 | 241 | |
243 | - if(!$headers) { |
|
242 | + if (!$headers) { |
|
244 | 243 | // Backwards compatible defaults |
245 | 244 | $headers = ['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR']; |
246 | 245 | } |
247 | 246 | |
248 | - foreach($headers as $header) { |
|
249 | - if(!empty($_SERVER[$header])) { |
|
247 | + foreach ($headers as $header) { |
|
248 | + if (!empty($_SERVER[$header])) { |
|
250 | 249 | $headerOverrideIP = $_SERVER[$header]; |
251 | 250 | |
252 | 251 | break; |
@@ -18,12 +18,12 @@ |
||
18 | 18 | class SentrySeverity |
19 | 19 | { |
20 | 20 | /** |
21 | - * Maps PHP's internal error-types into those suited to {@link Severity}. |
|
22 | - * |
|
23 | - * @param mixed int|string $severity The incoming level from userland code or |
|
24 | - * PHP itself. |
|
25 | - * @return string |
|
26 | - */ |
|
21 | + * Maps PHP's internal error-types into those suited to {@link Severity}. |
|
22 | + * |
|
23 | + * @param mixed int|string $severity The incoming level from userland code or |
|
24 | + * PHP itself. |
|
25 | + * @return string |
|
26 | + */ |
|
27 | 27 | public static function process_severity($severity) : string |
28 | 28 | { |
29 | 29 | // Stringified PHP severities out of \backtrace() like "notice" |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->context['env'] = $data; |
79 | 79 | break; |
80 | 80 | case 'tags': |
81 | - Hub::getCurrent()->configureScope(function (Scope $scope) use($data) : void { |
|
81 | + Hub::getCurrent()->configureScope(function(Scope $scope) use($data) : void { |
|
82 | 82 | foreach ($data as $tagName => $tagData) { |
83 | 83 | $scope->setTag($tagName, $tagData); |
84 | 84 | $this->context['tags'][$tagName] = $tagData; |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | }); |
87 | 87 | break; |
88 | 88 | case 'user': |
89 | - Hub::getCurrent()->configureScope(function (Scope $scope) use($data) : void { |
|
89 | + Hub::getCurrent()->configureScope(function(Scope $scope) use($data) : void { |
|
90 | 90 | $scope->setUser($data, true); |
91 | 91 | $this->context['user'] = $data; |
92 | 92 | }); |
93 | 93 | break; |
94 | 94 | case 'extra': |
95 | - Hub::getCurrent()->configureScope(function (Scope $scope) use($data) : void { |
|
95 | + Hub::getCurrent()->configureScope(function(Scope $scope) use($data) : void { |
|
96 | 96 | foreach ($data as $extraKey => $extraData) { |
97 | 97 | $scope->setExtra($extraKey, $extraData); |
98 | 98 | $this->context['extra'][$extraKey] = $extraData; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | }); |
101 | 101 | break; |
102 | 102 | case 'level': |
103 | - Hub::getCurrent()->configureScope(function (Scope $scope) use($data) : void { |
|
103 | + Hub::getCurrent()->configureScope(function(Scope $scope) use($data) : void { |
|
104 | 104 | $scope->setLevel(new Severity(SentrySeverity::process_severity($level = $data))); |
105 | 105 | }); |
106 | 106 | break; |