PHP Class WDS_WP_REST_API\Discover

ファイルを表示 Open project: webdevstudios/wds-wp-rest-api-connect Class Usage Examples

Protected Properties

Property Type Description
$args
$legacy
$root
$site WDS_WP_REST_API\Discover\Site Site object
$uri

Public Methods

Method Description
__construct ( string $uri, $args = [], boolean $legacy = false ) : Site | null Discover the WordPress API from a URI.
request ( string $uri, string $request_type = 'get' ) : mixed Make a request using the WP http API
site ( ) : Site Get the Site object

Protected Methods

Method Description
discover_api_root ( ) : string | null Discover the API root from an address.
get_index_information ( ) : Site Get the index information from a site.
parse_link_header ( string $link ) : array Parse a Link header into attributes.

Method Details

__construct() public method

Discover the WordPress API from a URI.
Since: 0.2.1
public __construct ( string $uri, $args = [], boolean $legacy = false ) : Site | null
$uri string URI to start the search from.
$legacy boolean Should we check for the legacy API too?
return WDS_WP_REST_API\Discover\Site | null Site data if available, null if not a WP site.

discover_api_root() protected method

Discover the API root from an address.
Since: 0.2.1
protected discover_api_root ( ) : string | null
return string | null API root URL if found, null if no API is available.

get_index_information() protected method

Get the index information from a site.
Since: 0.2.1
protected get_index_information ( ) : Site
return WDS_WP_REST_API\Discover\Site Data from the index for the site.

request() public method

Make a request using the WP http API
Since: 0.2.2
public request ( string $uri, string $request_type = 'get' ) : mixed
$uri string URI to make request to
$request_type string Type of request. Defaults to 'get'
return mixed Return of the request.

site() public method

Get the Site object
public site ( ) : Site
return WDS_WP_REST_API\Discover\Site

Property Details

$args protected_oe property

protected $args

$legacy protected_oe property

protected $legacy

$root protected_oe property

protected $root

$site protected_oe property

Site object
protected Site,WDS_WP_REST_API\Discover $site
return WDS_WP_REST_API\Discover\Site

$uri protected_oe property

protected $uri