Transport
in package
implements
TransportInterface
Base class for all transports
Tags
Interfaces, Classes and Traits
- TransportInterface
- Interface for all transports
Table of Contents
- $paramsFetcher : RequestParamsInterface|null
- Request params fetcher
- $router : Router
- Router
- $serviceLogics : array<string|int, ServiceBaseLogic>
- Service's logic objects array
- __construct() : mixed
- Constructor
- addRoute() : void
- Method adds's route
- addServiceLogic() : void
- Method adds service logic
- callLogic() : mixed
- Method runs logic functions
- callPublicLogic() : mixed
- Method runs logic functions
- errorResponse() : array<string|int, mixed>
- Error response compilator
- fetchActions() : void
- Method fetches actions for routes
- getParam() : string
- Method returns parameter
- getParamsFetcher() : RequestParamsInterface
- Method constructs request data fetcher
- getRouter() : Router
- Method returns router
- getServiceLogics() : array<string|int, ServiceBaseLogic>
- Method returns list of user logics
- handleException() : void
- Method processes exception
- loadRoute() : void
- Method loads single route
- loadRoutes() : void
- Method loads routes
- loadRoutesFromConfig() : void
- Method loads routes from config file
- outputException() : void
- Method outputs exception data
- routeExists() : bool
- Method returns true if the router exists
- run() : void
- Method runs router
- setServiceLogic() : void
- Method sets service logic
- setServiceLogics() : void
- Method sets service logic
- callRoute() : void
- Method calls route in transport specific way
- createFetcher() : RequestParamsInterface
- Method creates parameters fetcher
- formatCallStack() : array<string|int, mixed>
- Formatting call stack
- getNecessaryLogic() : ServiceBaseLogic
- Method searches necessary logic object
- logicCallPrepend() : void
- This method is called before logic calls
Properties
$paramsFetcher
Request params fetcher
private
RequestParamsInterface|null
$paramsFetcher
= null
$router
Router
private
Router
$router
$serviceLogics
Service's logic objects array
private
array<string|int, ServiceBaseLogic>
$serviceLogics
= []
Methods
__construct()
Constructor
public
__construct() : mixed
Return values
mixed —addRoute()
Method adds's route
public
addRoute(string $route, string $callback, mixed $requestMethod[, string $callType = 'callLogic' ]) : void
Parameters
- $route : string
-
route
- $callback : string
-
logic method to be called
- $requestMethod : mixed
-
HTTP request method
- $callType : string = 'callLogic'
-
type of the call
Tags
Return values
void —addServiceLogic()
Method adds service logic
public
addServiceLogic(ServiceBaseLogic $serviceLogic) : void
Parameters
- $serviceLogic : ServiceBaseLogic
-
base logic object or array
Return values
void —callLogic()
Method runs logic functions
public
callLogic(ServiceBaseLogic $serviceLogic, string $method[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $serviceLogic : ServiceBaseLogic
-
object with all service logic
- $method : string
-
logic's method to be executed
- $params : array<string|int, mixed> = []
-
logic's parameters
Return values
mixed —Result of the called method
callPublicLogic()
Method runs logic functions
public
callPublicLogic(ServiceBaseLogic $serviceLogic, string $method[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $serviceLogic : ServiceBaseLogic
-
object with all service logic
- $method : string
-
logic's method to be executed
- $params : array<string|int, mixed> = []
-
logic's parameters
Return values
mixed —result of the called method
errorResponse()
Error response compilator
public
errorResponse(mixed $e) : array<string|int, mixed>
Parameters
- $e : mixed
-
Exception object
Return values
array<string|int, mixed> —Error data
fetchActions()
Method fetches actions for routes
public
fetchActions(ServiceActionsInterface $actionsSource) : void
Parameters
- $actionsSource : ServiceActionsInterface
-
source of actions
Tags
Return values
void —getParam()
Method returns parameter
public
getParam(string $param[, mixed $default = false ]) : string
Parameters
- $param : string
-
Parameter name
- $default : mixed = false
-
Default value
Return values
string —Parameter value
getParamsFetcher()
Method constructs request data fetcher
public
getParamsFetcher() : RequestParamsInterface
Return values
RequestParamsInterface —request data fetcher
getRouter()
Method returns router
public
getRouter() : Router
Return values
Router —router
getServiceLogics()
Method returns list of user logics
public
getServiceLogics() : array<string|int, ServiceBaseLogic>
Tags
Return values
array<string|int, ServiceBaseLogic> —handleException()
Method processes exception
public
handleException(mixed $e) : void
Parameters
- $e : mixed
-
Exception object
Tags
Return values
void —loadRoute()
Method loads single route
public
loadRoute(array<string|int, mixed> $route) : void
Parameters
- $route : array<string|int, mixed>
-
route description
Return values
void —loadRoutes()
Method loads routes
public
loadRoutes(array<string|int, mixed> $routes) : void
Parameters
- $routes : array<string|int, mixed>
-
route descriptions
Tags
Return values
void —loadRoutesFromConfig()
Method loads routes from config file
public
loadRoutesFromConfig([string $path = './Conf/Routes.php' ]) : void
Parameters
- $path : string = './Conf/Routes.php'
-
path to the routes description
Tags
Return values
void —outputException()
Method outputs exception data
public
outputException(array<string|int, mixed> $e) : void
Parameters
- $e : array<string|int, mixed>
Return values
void —routeExists()
Method returns true if the router exists
public
routeExists(string $route) : bool
Parameters
- $route : string
-
checking route
Return values
bool —true if the router exists, false otherwise
run()
Method runs router
public
run() : void
Tags
Return values
void —setServiceLogic()
Method sets service logic
public
setServiceLogic(ServiceBaseLogic $serviceLogic) : void
Parameters
- $serviceLogic : ServiceBaseLogic
-
base logic object or array
Return values
void —setServiceLogics()
Method sets service logic
public
setServiceLogics(array<string|int, ServiceBaseLogic> $serviceLogics) : void
Parameters
- $serviceLogics : array<string|int, ServiceBaseLogic>
-
list of logic objects
Return values
void —callRoute()
Method calls route in transport specific way
protected
callRoute() : void
Return values
void —createFetcher()
Method creates parameters fetcher
protected
abstract createFetcher() : RequestParamsInterface
Return values
RequestParamsInterface —paremeters fetcher
formatCallStack()
Formatting call stack
protected
formatCallStack(mixed $e) : array<string|int, mixed>
Parameters
- $e : mixed
-
Exception object
Return values
array<string|int, mixed> —Call stack
getNecessaryLogic()
Method searches necessary logic object
protected
getNecessaryLogic(string $method) : ServiceBaseLogic
Parameters
- $method : string
-
necessary method
Return values
ServiceBaseLogic —logic object
logicCallPrepend()
This method is called before logic calls
protected
logicCallPrepend() : void
It is used in the derived classes ServiceHttpTransport and ServiceRestTransport to send HTTP headers