@@ -93,7 +93,7 @@ |
||
| 93 | 93 | * @param string $url |
| 94 | 94 | * @param string $method |
| 95 | 95 | * @param array $options |
| 96 | - * @return GuzzleHttp\Psr7\Response|null |
|
| 96 | + * @return Psr\Http\Message\ResponseInterface|null |
|
| 97 | 97 | */ |
| 98 | 98 | function fetch($url, $method = 'GET', $options = []) |
| 99 | 99 | { |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use GuzzleHttp\Client as HttpClient; |
| 4 | 4 | |
| 5 | -if (! function_exists('urlsafe_base64_encode')) { |
|
| 5 | +if (!function_exists('urlsafe_base64_encode')) { |
|
| 6 | 6 | /** |
| 7 | 7 | * Encodes the given data with base64, and returns an URL-safe string. |
| 8 | 8 | * |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | function urlsafe_base64_encode($data) |
| 13 | 13 | { |
| 14 | - return strtr(base64_encode($data), ['+' => '-', '/' => '_', '=' => '']); |
|
| 14 | + return strtr(base64_encode($data), [ '+' => '-', '/' => '_', '=' => '' ]); |
|
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if (! function_exists('urlsafe_base64_decode')) { |
|
| 18 | +if (!function_exists('urlsafe_base64_decode')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Decodes a base64 encoded data. |
| 21 | 21 | * |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -if (! function_exists('mb_trim')) { |
|
| 32 | +if (!function_exists('mb_trim')) { |
|
| 33 | 33 | /** |
| 34 | 34 | * Strip whitespace (or other characters) from the beginning and end of a string. |
| 35 | 35 | * |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if (! function_exists('string_value')) { |
|
| 47 | +if (!function_exists('string_value')) { |
|
| 48 | 48 | /** |
| 49 | 49 | * Converts any type to a string. |
| 50 | 50 | * |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -if (! function_exists('http_client')) { |
|
| 71 | +if (!function_exists('http_client')) { |
|
| 72 | 72 | /** |
| 73 | 73 | * Create a Guzzle http client. |
| 74 | 74 | * |
| 75 | 75 | * @param array $config |
| 76 | 76 | * @return \GuzzleHttp\Client |
| 77 | 77 | */ |
| 78 | - function http_client($config = []) |
|
| 78 | + function http_client($config = [ ]) |
|
| 79 | 79 | { |
| 80 | 80 | return new HttpClient( |
| 81 | 81 | array_merge([ |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | -if (! function_exists('fetch')) { |
|
| 89 | +if (!function_exists('fetch')) { |
|
| 90 | 90 | /** |
| 91 | 91 | * Request an URL. |
| 92 | 92 | * |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param array $options |
| 96 | 96 | * @return GuzzleHttp\Psr7\Response|null |
| 97 | 97 | */ |
| 98 | - function fetch($url, $method = 'GET', $options = []) |
|
| 98 | + function fetch($url, $method = 'GET', $options = [ ]) |
|
| 99 | 99 | { |
| 100 | 100 | try { |
| 101 | 101 | return http_client()->request($method, $url, $options); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -if (! function_exists('fetch_content')) { |
|
| 107 | +if (!function_exists('fetch_content')) { |
|
| 108 | 108 | /** |
| 109 | 109 | * Request an URL, and return the content. |
| 110 | 110 | * |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @param GuzzleHttp\Psr7\Response|null &$response |
| 115 | 115 | * @return string |
| 116 | 116 | */ |
| 117 | - function fetch_content($url, $method = 'GET', $options = [], &$response = null) |
|
| 117 | + function fetch_content($url, $method = 'GET', $options = [ ], &$response = null) |
|
| 118 | 118 | { |
| 119 | 119 | if ($response = fetch($url, $method, $options)) { |
| 120 | 120 | return (string) $response->getBody(); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -if (! function_exists('fetch_json')) { |
|
| 125 | +if (!function_exists('fetch_json')) { |
|
| 126 | 126 | /** |
| 127 | 127 | * Request an URL, and return the JSON data. |
| 128 | 128 | * |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param GuzzleHttp\Psr7\Response|null &$response |
| 133 | 133 | * @return mixed |
| 134 | 134 | */ |
| 135 | - function fetch_json($url, $method = 'GET', $options = [], &$response = null) |
|
| 135 | + function fetch_json($url, $method = 'GET', $options = [ ], &$response = null) |
|
| 136 | 136 | { |
| 137 | 137 | array_set($options, 'headers.Accept', 'application/json'); |
| 138 | 138 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | -if (! function_exists('request')) { |
|
| 143 | +if (!function_exists('request')) { |
|
| 144 | 144 | /** |
| 145 | 145 | * Get an instance of the current request or an input item from the request. |
| 146 | 146 | * |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | -if (! function_exists('active')) { |
|
| 165 | +if (!function_exists('active')) { |
|
| 166 | 166 | /** |
| 167 | 167 | * Returns string 'active' if the current request URI matches the given patterns. |
| 168 | 168 | * |
@@ -170,6 +170,6 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | function active() |
| 172 | 172 | { |
| 173 | - return call_user_func_array([app('request'), 'is'], func_get_args()) ? 'active' : ''; |
|
| 173 | + return call_user_func_array([ app('request'), 'is' ], func_get_args()) ? 'active' : ''; |
|
| 174 | 174 | } |
| 175 | 175 | } |