DiscordPHP-MTG Documentation

Endpoint
in package
implements EndpointInterface uses EndpointTrait

The route table for the "Magic: The Gathering Developers" API — one constant per endpoint (`cards`, `sets`, `sets/:id/booster`, `types`, `formats`, …), with `:param` placeholders bound via {@see EndpointTrait}. Same mechanics as DiscordPHP's own `Endpoint`, pointed at `api.magicthegathering.io`.

Tags
see
EndpointInterface

The contract this implements

since
0.1.0

Table of Contents

Interfaces

EndpointInterface

Constants

CARD  : mixed = self::CARDS . '/:id'
CARDS  : mixed = 'cards'
FORMATS  : mixed = 'formats'
REGEX  : string = '/:([^\/]*)/'
Regex to identify parameters in endpoints.
SET  : mixed = self::SETS . '/:id'
SETS  : mixed = 'sets'
SETS_BOOSTER  : mixed = self::SETS . '/:id/booster'
SUBTYPES  : mixed = 'subtypes'
SUPERTYPES  : mixed = 'supertypes'
TYPES  : mixed = 'types'

Properties

$args  : array<string|int, string>
Array of arguments to substitute into the endpoint.
$endpoint  : string
The string version of the endpoint, including all parameters.
$query  : array<string|int, mixed>
Array of query data to be appended to the end of the endpoint with `http_build_query`.
$vars  : array<string|int, string>
Array of placeholders to be replaced in the endpoint.

Methods

__construct()  : mixed
Creates an endpoint class.

Constants

CARD

public mixed CARD = self::CARDS . '/:id'

FORMATS

public mixed FORMATS = 'formats'

REGEX

Regex to identify parameters in endpoints.

public string REGEX = '/:([^\/]*)/'

SET

public mixed SET = self::SETS . '/:id'

SETS_BOOSTER

public mixed SETS_BOOSTER = self::SETS . '/:id/booster'

SUBTYPES

public mixed SUBTYPES = 'subtypes'

SUPERTYPES

public mixed SUPERTYPES = 'supertypes'

Properties

$args

Array of arguments to substitute into the endpoint.

protected array<string|int, string> $args = []

$endpoint

The string version of the endpoint, including all parameters.

protected string $endpoint

$query

Array of query data to be appended to the end of the endpoint with `http_build_query`.

protected array<string|int, mixed> $query = []

$vars

Array of placeholders to be replaced in the endpoint.

protected array<string|int, string> $vars = []

Methods

__construct()

Creates an endpoint class.

public __construct(string $endpoint) : mixed
Parameters
$endpoint : string
On this page

Search results