-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoload.php
More file actions
30 lines (26 loc) · 821 Bytes
/
Copy pathautoload.php
File metadata and controls
30 lines (26 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
* Mantle HTTP Client Helpers
*
* Intentionally not Namespaced to allow for root-level access to
* framework methods.
*
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound, Squiz.Commenting.FunctionComment
*
* @package Mantle
*/
declare(strict_types=1);
namespace Mantle\Http_Client;
use Mantle\Http_Client\Pending_Request;
use Mantle\Http_Client\Response;
if ( ! function_exists( __NAMESPACE__ . '\\http_client' ) ) {
/**
* Create a new pending request of the the HTTP Client.
*
* @param string|null $url URL to request, optional.
* @return ($url is string ? Response : Pending_Request)
*/
function http_client( ?string $url = null ): Pending_Request|Response {
return $url ? Pending_Request::create()->get( $url ) : Pending_Request::create();
}
}