Properties

$ParamsFetcher

$ParamsFetcher : \HTTPRequestParams

Request params fetcher

Type

\HTTPRequestParams

$ServiceLogic

$ServiceLogic : \ServiceLogic

Service's logic

Type

\ServiceLogic

$Router

$Router : \Router

Router

Type

\Router

$SecurityProvider

$SecurityProvider : \ServiceSecurityProvider

Security provider

Type

\ServiceSecurityProvider — Provider of the securitty routines

Methods

__construct()

__construct(mixed  $SecurityProvider = 'ServiceMockSecurityProvider') 

Constructor.

Parameters

mixed $SecurityProvider
  • Security provider.

create_session()

create_session(string  $Token = '') : string

Method creates session from existing token or fetched from HTTP headers.

Parameters

string $Token
  • Session token.

Returns

string —

Session token.

add_route()

add_route(string  $Route, string  $Method, string  $Request, string  $CallType = 'call_logic') 

Method adds's route

Parameters

string $Route

Route

string $Method

Logic method to be called

string $Request

HTTP request method

string $CallType

Type of the call

load_route()

load_route(array  $Route) 

Method loads single route

Parameters

array $Route

Route description

load_routes()

load_routes(array  $Routes) 

Method loads routes

Parameters

array $Routes

Route descriptions

load_routes_from_config()

load_routes_from_config(string  $Path = './conf/routes.php') 

Method loads routes from config file

Parameters

string $Path

Path to the routes description

call_logic()

call_logic(\ServiceLogic  $ServiceLogic, string  $Method, array  $Params = array()) : mixed

Method runs logic functions.

Parameters

\ServiceLogic $ServiceLogic

- object with all service logic.

string $Method

- logic's method to be executed.

array $Params

- logic's parameters.

Returns

mixed —

Result of the called method.

call_public_logic()

call_public_logic(\ServiceLogic  $ServiceLogic, string  $Method, array  $Params = array()) : mixed

Method runs logic functions.

Parameters

\ServiceLogic $ServiceLogic

- object with all service logic.

string $Method

- logic's method to be executed.

array $Params

- logic's parameters.

Returns

mixed —

Result of the called method.

error_response()

error_response(mixed  $e) : array

Error response compilator

Parameters

mixed $e

Exception object

Returns

array —

Error data

get_param()

get_param(string  $Param, mixed  $Default = false) : string

Method returns parameter

Parameters

string $Param

Parameter name

mixed $Default

Default value

Returns

string —

Parameter value

run()

run() 

Method runs router

get_params_fetcher()

get_params_fetcher() : \HTTPRequestParams

Method constructs request data fetcher.

Returns

\HTTPRequestParams

Request data fetcher.

get_necessary_logic()

get_necessary_logic(string  $Method) : \ServiceLogic

Method searches necessary logic object

Parameters

string $Method

Necessary method

Returns

\ServiceLogic

Logic object

format_call_stack()

format_call_stack(mixed  $e) : array

Formatting call stack

Parameters

mixed $e

Exception object

Returns

array —

Call stack

header()

header(string  $Header, string  $Value) 

Method outputs HTTP header.

Parameters

string $Header
  • Header name.
string $Value
  • Header value.