Documentation

AdhocProvider
in package
implements EventSubscriberInterface, ProviderInterface

An adhoc provider is useful for creating mock API implementations.

Table of Contents

Interfaces

EventSubscriberInterface
ProviderInterface
An API "provider" provides a means to execute API requests.

Properties

$actions  : array<string|int, mixed>
List of adhoc actions
$entity  : string
$version  : int

Methods

__construct()  : mixed
addAction()  : AdhocProvider
Register a new API.
getActionNames()  : array<string|int, mixed>
getEntityNames()  : array<string|int, mixed>
getSubscribedEvents()  : array<string|int, mixed>
invoke()  : array<string|int, mixed>|mixed
matchesRequest()  : bool
onApiAuthorize()  : mixed
onApiResolve()  : mixed

Properties

$actions

List of adhoc actions

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

array(string $ame => array('perm' => string, 'callback' => callable))

Methods

__construct()

public __construct(int $version, string $entity) : mixed
Parameters
$version : int

API version.

$entity : string

API entity.

addAction()

Register a new API.

public addAction(string $name, string $perm, mixed $callback) : AdhocProvider
Parameters
$name : string

Action name.

$perm : string

Permissions required for invoking the action.

$callback : mixed

The function which executes the API.

Return values
AdhocProvider

getActionNames()

public getActionNames(int $version, string $entity) : array<string|int, mixed>
Parameters
$version : int
$entity : string
Tags
inheritDoc
Return values
array<string|int, mixed>

getEntityNames()

public getEntityNames(int $version) : array<string|int, mixed>
Parameters
$version : int
Tags
inheritDoc
Return values
array<string|int, mixed>

getSubscribedEvents()

public static getSubscribedEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>

invoke()

public invoke(array<string|int, mixed> $apiRequest) : array<string|int, mixed>|mixed
Parameters
$apiRequest : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>|mixed

matchesRequest()

public matchesRequest(array<string|int, mixed> $apiRequest) : bool
Parameters
$apiRequest : array<string|int, mixed>

The full description of the API request.

Return values
bool

        
On this page

Search results