Merge pull request #2174 from oovk/master

Fixed PSR issues in the URL library
This commit is contained in:
Christy Jacob 2021-10-11 14:18:32 +05:30 committed by GitHub
commit 93f74afce0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,7 @@ class URL
* *
* @return array * @return array
*/ */
public static function parse(string $url):array public static function parse(string $url): array
{ {
$default = [ $default = [
'scheme' => '', 'scheme' => '',
@ -39,7 +39,7 @@ class URL
* *
* @return string * @return string
*/ */
public static function unparse(array $url, array $ommit = []):string public static function unparse(array $url, array $ommit = []): string
{ {
if (isset($url['path']) && \mb_substr($url['path'], 0, 1) !== '/') { if (isset($url['path']) && \mb_substr($url['path'], 0, 1) !== '/') {
$url['path'] = '/'.$url['path']; $url['path'] = '/'.$url['path'];
@ -55,7 +55,7 @@ class URL
$parts['user'] = isset($url['user']) ? $url['user'] : ''; $parts['user'] = isset($url['user']) ? $url['user'] : '';
$parts['pass'] = isset($url['pass']) ? ':'.$url['pass'] : ''; $parts['pass'] = isset($url['pass']) ? ':'.$url['pass'] : '';
$parts['pass'] = ($parts['user'] || $parts['pass']) ? $parts['pass'].'@' : ''; $parts['pass'] = ($parts['user'] || $parts['pass']) ? $parts['pass'].'@' : '';
@ -85,7 +85,7 @@ class URL
* *
* @return array * @return array
*/ */
public static function parseQuery(string $query):array public static function parseQuery(string $query): array
{ {
\parse_str($query, $result); \parse_str($query, $result);
@ -101,7 +101,7 @@ class URL
* *
* @return string * @return string
*/ */
public static function unparseQuery(array $query):string public static function unparseQuery(array $query): string
{ {
return \http_build_query($query); return \http_build_query($query);
} }