@@ -302,12 +302,18 @@ public function __construct(string $http_method, string $http_url, array $parame
302302 /**
303303 * attempt to build up a request from what was passed to the server
304304 */
305- public static function from_request (string $ http_method = null , string $ http_url = null , array $ parameters = null ): self
305+ public static function from_request (
306+ string $ http_method = null ,
307+ string $ http_url = null ,
308+ array $ parameters = null
309+ ): self
306310 {
307311 $ scheme = (!isset ($ _SERVER ['HTTPS ' ]) || $ _SERVER ['HTTPS ' ] != 'on ' )
308312 ? 'http '
309313 : 'https ' ;
310- $ http_url = ($ http_url ) ? $ http_url : $ scheme .
314+ $ http_url = ($ http_url )
315+ ? $ http_url
316+ : $ scheme .
311317 ':// ' . $ _SERVER ['HTTP_HOST ' ] .
312318 ': ' .
313319 $ _SERVER ['SERVER_PORT ' ] .
@@ -339,7 +345,10 @@ public static function from_request(string $http_method = null, string $http_url
339345
340346 // We have a Authorization-header with OAuth data. Parse the header
341347 // and add those overriding any duplicates from GET or POST
342- if (isset ($ request_headers ['Authorization ' ]) && substr ($ request_headers ['Authorization ' ], 0 , 6 ) == 'OAuth ' ) {
348+ if (
349+ isset ($ request_headers ['Authorization ' ])
350+ && substr ($ request_headers ['Authorization ' ], 0 , 6 ) == 'OAuth '
351+ ) {
343352 $ header_parameters = Util::split_header (
344353 $ request_headers ['Authorization ' ]
345354 );
@@ -354,7 +363,13 @@ public static function from_request(string $http_method = null, string $http_url
354363 /**
355364 * pretty much a helper function to set up the request
356365 */
357- public static function from_consumer_and_token (Consumer $ consumer , ?Token $ token , string $ http_method , string $ http_url , array $ parameters = null ): self
366+ public static function from_consumer_and_token (
367+ Consumer $ consumer ,
368+ ?Token $ token ,
369+ string $ http_method ,
370+ string $ http_url ,
371+ array $ parameters = null
372+ ): self
358373 {
359374 $ parameters = $ parameters ?: [];
360375 $ defaults = [
@@ -392,7 +407,7 @@ public function set_parameter(string $name, $value, bool $allow_duplicates = tru
392407
393408 public function get_parameter (string $ name )
394409 {
395- return isset ( $ this ->parameters [$ name ]) ? $ this -> parameters [ $ name ] : null ;
410+ return $ this ->parameters [$ name ] ?? null ;
396411 }
397412
398413
@@ -465,7 +480,9 @@ public function get_normalized_http_url(): string
465480 $ parts = parse_url ($ this ->http_url );
466481
467482 $ scheme = (isset ($ parts ['scheme ' ])) ? $ parts ['scheme ' ] : 'http ' ;
468- $ port = (isset ($ parts ['port ' ])) ? $ parts ['port ' ] : (($ scheme == 'https ' ) ? '443 ' : '80 ' );
483+ $ port = (isset ($ parts ['port ' ]))
484+ ? $ parts ['port ' ]
485+ : (($ scheme == 'https ' ) ? '443 ' : '80 ' );
469486 $ host = (isset ($ parts ['host ' ])) ? $ parts ['host ' ] : '' ;
470487 $ path = (isset ($ parts ['path ' ])) ? $ parts ['path ' ] : '' ;
471488
@@ -581,7 +598,7 @@ class Util
581598 public static function urlencode_rfc3986 ($ input )
582599 {
583600 if (is_array ($ input )) {
584- return array_map ([__CLASS__ , 'urlencode_rfc3986 ' ], $ input );
601+ return array_map ([self ::class , 'urlencode_rfc3986 ' ], $ input );
585602 } elseif (is_scalar ($ input )) {
586603 return str_replace ('+ ' , ' ' , str_replace ('%7E ' , '~ ' , rawurlencode ((string ) $ input )));
587604 } else {
0 commit comments