class Kernel

Properties

protected EventDispatcher $dispatcher
protected array $apiProviders

Methods

__construct(EventDispatcher $dispatcher, array $apiProviders = array())

No description

array|int
run(string $entity, string $action, array $params, mixed $extra = NULL) deprecated

No description

array|int
runSafe(string $entity, string $action, array $params, mixed $extra = NULL)

Parse and execute an API request. Any errors will be converted to normal format.

bool
runAuthorize(string $entity, string $action, array $params, mixed $extra = NULL)

Determine if a hypothetical API call would be authorized.

array
runRequest(array $apiRequest)

Execute an API request.

boot(Action|array $apiRequest)

Bootstrap - Load basic dependencies and sanity-check inputs.

validate(array $apiRequest)

No description

array
resolve(array $apiRequest)

Determine which, if any, service will execute the API request.

authorize(ProviderInterface $apiProvider, array $apiRequest)

Determine if the API request is allowed (under current policy)

array
prepare(ProviderInterface $apiProvider, array $apiRequest)

Allow third-party code to manipulate the API request before execution.

mixed
respond(ProviderInterface $apiProvider, array $apiRequest, array $result)

Allow third-party code to manipulate the API response after execution.

array
getEntityNames(int $version)

No description

array
getActionNames(int $version, string $entity)

No description

array
formatException(Exception $e, array $apiRequest)

No description

array
formatApiException(API_Exception $e, array $apiRequest)

No description

array
formatPearException(PEAR_Exception $e, array $apiRequest)

No description

array
createError(string $msg, array $data, array $apiRequest, mixed $code = NULL)

No description

mixed
formatResult(array $apiRequest, array $result)

No description

array
getApiProviders()

No description

setApiProviders(array $apiProviders)

No description

registerApiProvider(ProviderInterface $apiProvider)

No description

EventDispatcher
getDispatcher()

No description

setDispatcher(EventDispatcher $dispatcher)

No description

Details

at line 58
__construct(EventDispatcher $dispatcher, array $apiProviders = array())

Parameters

EventDispatcher $dispatcher The event dispatcher which receives kernel events.
array $apiProviders Array of ProviderInterface.

at line 76
array|int run(string $entity, string $action, array $params, mixed $extra = NULL) deprecated

deprecated

Parameters

string $entity Type of entities to deal with.
string $action Create, get, delete or some special action name.
array $params Array to be passed to API function.
mixed $extra Unused/deprecated.

Return Value

array|int

See also

runSafe

at line 96
array|int runSafe(string $entity, string $action, array $params, mixed $extra = NULL)

Parse and execute an API request. Any errors will be converted to normal format.

Parameters

string $entity Type of entities to deal with.
string $action Create, get, delete or some special action name.
array $params Array to be passed to API function.
mixed $extra Unused/deprecated.

Return Value

array|int

Exceptions

API_Exception

at line 136
bool runAuthorize(string $entity, string $action, array $params, mixed $extra = NULL)

Determine if a hypothetical API call would be authorized.

Parameters

string $entity Type of entities to deal with.
string $action Create, get, delete or some special action name.
array $params Array to be passed to function.
mixed $extra Unused/deprecated.

Return Value

bool TRUE if authorization would succeed.

Exceptions

Exception

at line 162
array runRequest(array $apiRequest)

Execute an API request.

The request must be in canonical format. Exceptions will be propagated out.

Parameters

array $apiRequest

Return Value

array

Exceptions

API_Exception
NotImplementedException
UnauthorizedException

at line 180
boot(Action|array $apiRequest)

Bootstrap - Load basic dependencies and sanity-check inputs.

Parameters

Action|array $apiRequest

Exceptions

API_Exception

at line 206
protected validate(array $apiRequest)

Parameters

array $apiRequest

Exceptions

API_Exception

at line 219
array resolve(array $apiRequest)

Determine which, if any, service will execute the API request.

Parameters

array $apiRequest The full description of the API request.

Return Value

array A tuple with the provider-object and a revised apiRequest. Array(0 => ProviderInterface, 1 => array $apiRequest).

Exceptions

NotImplementedException

at line 238
authorize(ProviderInterface $apiProvider, array $apiRequest)

Determine if the API request is allowed (under current policy)

Parameters

ProviderInterface $apiProvider The API provider responsible for executing the request.
array $apiRequest The full description of the API request.

Exceptions

UnauthorizedException

at line 256
array prepare(ProviderInterface $apiProvider, array $apiRequest)

Allow third-party code to manipulate the API request before execution.

Parameters

ProviderInterface $apiProvider The API provider responsible for executing the request.
array $apiRequest The full description of the API request.

Return Value

array The revised API request.

at line 274
mixed respond(ProviderInterface $apiProvider, array $apiRequest, array $result)

Allow third-party code to manipulate the API response after execution.

Parameters

ProviderInterface $apiProvider The API provider responsible for executing the request.
array $apiRequest The full description of the API request.
array $result The response to return to the client.

Return Value

mixed The revised $result.

at line 286
array getEntityNames(int $version)

Parameters

int $version API version.

Return Value

array Array.

at line 306
array getActionNames(int $version, string $entity)

Parameters

int $version API version.
string $entity API entity.

Return Value

array Array

at line 326
array formatException(Exception $e, array $apiRequest)

Parameters

Exception $e An unhandled exception.
array $apiRequest The full description of the API request.

Return Value

array API response.

at line 342
array formatApiException(API_Exception $e, array $apiRequest)

Parameters

API_Exception $e An unhandled exception.
array $apiRequest The full description of the API request.

Return Value

array (API response)

at line 364
array formatPearException(PEAR_Exception $e, array $apiRequest)

Parameters

PEAR_Exception $e An unhandled exception.
array $apiRequest The full description of the API request.

Return Value

array API response.

at line 401
array createError(string $msg, array $data, array $apiRequest, mixed $code = NULL)

Parameters

string $msg Descriptive error message.
array $data Error data.
array $apiRequest The full description of the API request.
mixed $code Doesn't appear to be used.

Return Value

array Array.

Exceptions

API_Exception

at line 430
mixed formatResult(array $apiRequest, array $result)

Parameters

array $apiRequest The full description of the API request.
array $result The response to return to the client.

Return Value

mixed

at line 447
array getApiProviders()

Return Value

array

at line 456
Kernel setApiProviders(array $apiProviders)

Parameters

array $apiProviders Array.

Return Value

Kernel

at line 466
Kernel registerApiProvider(ProviderInterface $apiProvider)

Parameters

ProviderInterface $apiProvider The API provider responsible for executing the request.

Return Value

Kernel

at line 477
EventDispatcher getDispatcher()

Return Value

EventDispatcher

at line 486
Kernel setDispatcher(EventDispatcher $dispatcher)

Parameters

EventDispatcher $dispatcher The event dispatcher which receives kernel events.

Return Value

Kernel