RestApiWadlController
extends HttpController
in package
Class RestApiWadlController
Table of Contents
Constants
- ATTR_ID = 'id'
- ATTR_MEDIA_TYPE = 'mediaType'
- ATTR_NAME = 'name'
- ATTR_PATH = 'path'
- ATTR_REQUIRED = 'required'
- ATTR_STATUS = 'status'
- ATTR_STYLE = 'style'
- ATTR_TITLE = 'title'
- ENDPOINT_URL = WEB_ROOT . 'api'
- MIMETYPE_JSON = 'application/json'
- OPTION_PAGE_DESCRIPTION = 'pageDescription'
- OPTION_PAGE_TITLE = 'pageTitle'
- TAG_DOC = 'doc'
- TAG_METHOD = 'method'
- TAG_PARAM = 'param'
- TAG_REPRESENTATION = 'representation'
- TAG_REQUEST = 'request'
- TAG_RESOURCE = 'resource'
- TAG_RESOURCE_LIST = 'resources'
- TAG_RESPONSE = 'response'
Properties
- $catchControllerOutput : bool
- Catch controller output when running it
- $options : array<string|int, mixed>
- Running options for this controller
- $route : ControllerRoute|null
- The route calling this controller A controller could be called without any route and any request This variable comes to get the route without any request
- $api : object
- $entityActions : array<string|int, RestRouteGenerator>
- $entityResPath : string
- $itemActions : array<string|int, RestRouteGenerator>
- $itemResPath : string
- $request : InputRequest|null
- The request calling this controller
Methods
- __construct() : mixed
- Controller constructor
- __toString() : string
- Get this controller as string
- fillValues() : void
- Fill array with default values
- getApi() : object
- getCurrentUrl() : string
- getOption() : string|mixed
- Get an option by $key
- getRequest() : InputRequest|null
- Get the request
- getRoute() : ControllerRoute|null
- Get the route
- getRouteName() : string|null
- Get the route name
- getValues() : array<string|int, mixed>
- Get parameter values of this controller Use it to generate routes (as for menus) with path parameters & you can get the current context
- postRun() : OutputResponse|null
- After running the controller
- prepare() : OutputResponse|null
- Prepare environment for this route
- preRun() : OutputResponse|null
- Before running controller
- preRun() : HttpResponse|null
- Before running controller
- process() : OutputResponse|null
- Process the $request
- processException() : HttpResponse
- processUserException() : mixed
- Process the given UserException
- render() : mixed
- Render the given $layout in $response using $values
- renderHtml() : HtmlHttpResponse
- Render the given $layout with $values
- run() : XmlHttpResponse
- Run this controller
- run() : HttpResponse
- Run this controller
- setOption() : AbstractController
- Set an option by $key
- setOptions() : AbstractController
- Set an option by $key
- addAllEntityResources() : void
- addEntityResource() : SimpleXMLElement|null
- addJsonRepresentation() : void
- addResource() : SimpleXMLElement|null
- addResponse() : void
- addTitle() : void
- concatSlug() : string
- convertKeyToName() : string
- redirectToSelf() : RedirectHttpResponse
Constants
ATTR_ID
public
mixed
ATTR_ID
= 'id'
ATTR_MEDIA_TYPE
public
mixed
ATTR_MEDIA_TYPE
= 'mediaType'
ATTR_NAME
public
mixed
ATTR_NAME
= 'name'
ATTR_PATH
public
mixed
ATTR_PATH
= 'path'
ATTR_REQUIRED
public
mixed
ATTR_REQUIRED
= 'required'
ATTR_STATUS
public
mixed
ATTR_STATUS
= 'status'
ATTR_STYLE
public
mixed
ATTR_STYLE
= 'style'
ATTR_TITLE
public
mixed
ATTR_TITLE
= 'title'
ENDPOINT_URL
public
mixed
ENDPOINT_URL
= WEB_ROOT . 'api'
MIMETYPE_JSON
public
mixed
MIMETYPE_JSON
= 'application/json'
OPTION_PAGE_DESCRIPTION
public
mixed
OPTION_PAGE_DESCRIPTION
= 'pageDescription'
OPTION_PAGE_TITLE
public
mixed
OPTION_PAGE_TITLE
= 'pageTitle'
TAG_DOC
public
mixed
TAG_DOC
= 'doc'
TAG_METHOD
public
mixed
TAG_METHOD
= 'method'
TAG_PARAM
public
mixed
TAG_PARAM
= 'param'
TAG_REPRESENTATION
public
mixed
TAG_REPRESENTATION
= 'representation'
TAG_REQUEST
public
mixed
TAG_REQUEST
= 'request'
TAG_RESOURCE
public
mixed
TAG_RESOURCE
= 'resource'
TAG_RESOURCE_LIST
public
mixed
TAG_RESOURCE_LIST
= 'resources'
TAG_RESPONSE
public
mixed
TAG_RESPONSE
= 'response'
Properties
$catchControllerOutput
Catch controller output when running it
protected
bool
$catchControllerOutput
= false
$options
Running options for this controller
protected
array<string|int, mixed>
$options
= []
$route
The route calling this controller A controller could be called without any route and any request This variable comes to get the route without any request
protected
ControllerRoute|null
$route
= null
$api
private
object
$api
$entityActions
private
array<string|int, RestRouteGenerator>
$entityActions
$entityResPath
private
string
$entityResPath
$itemActions
private
array<string|int, RestRouteGenerator>
$itemActions
$itemResPath
private
string
$itemResPath
$request
The request calling this controller
private
InputRequest|null
$request
= null
Methods
__construct()
Controller constructor
public
__construct(ControllerRoute|null $route, array<string|int, mixed> $options) : mixed
Parameters
- $route : ControllerRoute|null
- $options : array<string|int, mixed>
__toString()
Get this controller as string
public
__toString() : string
Return values
stringfillValues()
Fill array with default values
public
fillValues([array<string|int, mixed> &$values = [] ]) : void
Parameters
- $values : array<string|int, mixed> = []
getApi()
public
getApi() : object
Return values
objectgetCurrentUrl()
public
getCurrentUrl() : string
Return values
stringgetOption()
Get an option by $key
public
getOption(string $key[, mixed|null $default = null ]) : string|mixed
Parameters
- $key : string
- $default : mixed|null = null
Return values
string|mixedgetRequest()
Get the request
public
getRequest() : InputRequest|null
Return values
InputRequest|nullgetRoute()
Get the route
public
getRoute() : ControllerRoute|null
Return values
ControllerRoute|nullgetRouteName()
Get the route name
public
getRouteName() : string|null
Return values
string|nullgetValues()
Get parameter values of this controller Use it to generate routes (as for menus) with path parameters & you can get the current context
public
getValues() : array<string|int, mixed>
Return values
array<string|int, mixed>postRun()
After running the controller
public
postRun(mixed $request, mixed $response) : OutputResponse|null
Parameters
- $request : mixed
- $response : mixed
Tags
Return values
OutputResponse|nullprepare()
Prepare environment for this route
public
prepare(mixed $request) : OutputResponse|null
Parameters
- $request : mixed
Return values
OutputResponse|nullpreRun()
Before running controller
public
preRun(mixed $request) : OutputResponse|null
Parameters
- $request : mixed
Return values
OutputResponse|nullpreRun()
Before running controller
public
preRun(mixed $request) : HttpResponse|null
Parameters
- $request : mixed
Return values
HttpResponse|nullprocess()
Process the $request
public
process() : OutputResponse|null
Tags
Return values
OutputResponse|nullprocessException()
public
processException(Exception $exception[, array<string|int, mixed> $values = [] ]) : HttpResponse
Parameters
- $exception : Exception
- $values : array<string|int, mixed> = []
Return values
HttpResponseprocessUserException()
Process the given UserException
public
processUserException(UserException $exception) : mixed
Parameters
- $exception : UserException
Tags
render()
Render the given $layout in $response using $values
public
render(OutputResponse $response, string $layout[, array<string|int, mixed> $values = [] ]) : mixed
Parameters
- $response : OutputResponse
- $layout : string
- $values : array<string|int, mixed> = []
Return values
mixed —The $response
renderHtml()
Render the given $layout with $values
public
renderHtml(string $layout[, array<string|int, mixed> $values = [] ]) : HtmlHttpResponse
Parameters
- $layout : string
- $values : array<string|int, mixed> = []
Return values
HtmlHttpResponserun()
Run this controller
public
run(HttpRequest $request) : XmlHttpResponse
Parameters
- $request : HttpRequest
Tags
Return values
XmlHttpResponserun()
Run this controller
public
run(mixed $request) : HttpResponse
Parameters
- $request : mixed
Return values
HttpResponsesetOption()
Set an option by $key
public
setOption(string $key, mixed $value) : AbstractController
Parameters
- $key : string
- $value : mixed
Return values
AbstractControllersetOptions()
Set an option by $key
public
setOptions(array<string|int, mixed> $options) : AbstractController
Parameters
- $options : array<string|int, mixed>
Return values
AbstractControlleraddAllEntityResources()
protected
addAllEntityResources(SimpleXMLElement $xml, string $entityKey, string $entityPath, string $class, array<string|int, mixed> $children[, bool $itemOnly = false ]) : void
Parameters
- $xml : SimpleXMLElement
- $entityKey : string
- $entityPath : string
- $class : string
- $children : array<string|int, mixed>
- $itemOnly : bool = false
addEntityResource()
protected
addEntityResource(SimpleXMLElement $xml, mixed $entityKey, mixed $entityPath, mixed $entityName) : SimpleXMLElement|null
Parameters
- $xml : SimpleXMLElement
- $entityKey : mixed
- $entityPath : mixed
- $entityName : mixed
Return values
SimpleXMLElement|nulladdJsonRepresentation()
protected
addJsonRepresentation(SimpleXMLElement $xml) : void
Parameters
- $xml : SimpleXMLElement
addResource()
protected
addResource(SimpleXMLElement $xml, string $key, string $path, array<string|int, mixed> $methods, string $name) : SimpleXMLElement|null
Parameters
- $xml : SimpleXMLElement
- $key : string
- $path : string
- $methods : array<string|int, mixed>
- $name : string
Return values
SimpleXMLElement|nulladdResponse()
protected
addResponse(SimpleXMLElement $xml, string $status) : void
Parameters
- $xml : SimpleXMLElement
- $status : string
addTitle()
protected
addTitle(SimpleXMLElement $xml, string $title) : void
Parameters
- $xml : SimpleXMLElement
- $title : string
concatSlug()
protected
concatSlug(string $before, string $after) : string
Parameters
- $before : string
- $after : string
Return values
stringconvertKeyToName()
protected
convertKeyToName(string $key) : string
Parameters
- $key : string
Return values
stringredirectToSelf()
protected
redirectToSelf() : RedirectHttpResponse