Server

Class Rest\Server Is the front controller for mapping URL to controllers and dealing with Request/Response and Headers Made with Restful webservices in mind.

By Diogo Souza da Silva manifesto@manifesto.blog.br

Methods

Contructor of Rest\Server

__construct(string $query = null) : \Rest\Rest\Server

Arguments

$query

string

Optional query to be treat as the URL

Response

\Rest\Rest\Server

$rest;

Sets a parameter in a global scope that can be recovered at any request.

setParameter(mixed $key, mixed $value) : \Rest\Rest\Server

Arguments

$key

mixed

The identifier of the parameter

$value

mixed

The content of the parameter

Response

\Rest\Rest\Server

$this

Return all parameters

getParameters() : mixed

Response

mixed

Return the specified parameter

getParameter(mixed $key) : mixed

Arguments

$key

mixed

The parameter identifier

Response

mixed

Maps a Method and URL for a Class

addMap(string $method, string $uri, string $class, $accept = null) : \Rest\Rest\Server

Arguments

$method

string

The method to be associated

$uri

string

The URL to be accossiated

$class

string

The name of the class to be called, it must implement RestAction

$accept

Response

\Rest\Rest\Server

Set Accepted mime types globally

setAccept(array $mimes) : \Rest\Rest\Server

Arguments

$mimes

array

Response

\Rest\Rest\Server

Set the URL to be handle or part of it

setQuery(string $value) : \Rest\Rest\Server

Arguments

$value

string

The url

Response

\Rest\Rest\Server

$this

Get the URL or part of it, depreciated by RestRequest::getURI();

getQuery(mixed $k = null) : string

Arguments

$k

mixed

uri part

Response

string

Get the baseurl, based on website location (eg. localhost/website or website.com/);

getBaseUrl() : string

Response

string

Get the Response handler object

getResponse() : \Rest\Rest\Response

Response

\Rest\Rest\Response

Get the Request handler object

getRequest() : \Rest\Rest\Request

Response

\Rest\Rest\Request

Get the Authentication handler object

getAuthenticator() : \Rest\Rest\Authenticator

Response

\Rest\Rest\Authenticator

Get the class for specified method and uri

getMap(string $method, string $uri, $ext = false) : string

Arguments

$method

string

$uri

string

$ext

Response

string

Set matched map for request

setMatch($map) : \Rest\Rest\Server

Arguments

$map

Response

\Rest\Rest\Server

Return matched exploded uri for request

getMatch() : string

Response

string

Return last class name from Rest\Server stack trace

lastClass() : string

Response

string

Run the Server to handle the request and prepare the response

execute($echo = true) : \Rest\Rest\Server

Arguments

$echo

Response

\Rest\Rest\Server

call

call($object, $method) 

Arguments

$object

$method

Properties

response

response

request

request

authenticator

authenticator

baseUrl

baseUrl

query

query

map

map

matched

matched

params

params

stack

stack

acceptMimes

acceptMimes