Documentation

AjaxApplication extends Application
in package
Uses AjaxMethodsTrait

Base class of the ajax-application

Table of Contents

$requestParams  : HttpRequestParams|null
Params fetcher
$router  : Router
Router object
__call()  : mixed
Allowing to call methods added on the fly
__construct()  : mixed
Constructor
buildRoute()  : array<string|int, mixed>
Method builds route data
getRequestParamsFetcher()  : RequestParamsInterface
Method returns $this->requestParams and creates this object if necessery
getRouter()  : Router
Method returns router
handleException()  : void
Method processes exception.
loadRoute()  : void
Method loads single route
loadRoutes()  : void
Method loads routes
loadRoutesFromConfig()  : void
Method loads routes from config file in *.php or *.json format
loadRoutesFromConfigs()  : void
Method loads list of configs
loadRoutesFromDirectory()  : void
Method loads routes from the directory
redirectTo()  : void
Method redirects user to another page
routeExists()  : bool
Method validates that route exists
run()  : void
Running application
ajaxRequestError()  : void
Method finishes ajax requests processing
ajaxRequestResult()  : void
Method finishes ajax requests processing and returns result
ajaxRequestSuccess()  : void
Method finishes ajax requests processing
callRoute()  : mixed
Method calls route and returns it's content
formatCallStack()  : array<string|int, mixed>
Formatting call stack

Properties

Methods

__call()

Allowing to call methods added on the fly

public __call(string $method, array<string|int, mixed> $args) : mixed
Parameters
$method : string

Method to be called

$args : array<string|int, mixed>

Arguments

Return values
mixed

Result of the call

__construct()

Constructor

public __construct() : mixed
Return values
mixed

buildRoute()

Method builds route data

public static buildRoute(string $route, string $method, object $handler, string $function) : array<string|int, mixed>
Parameters
$route : string

route

$method : string

HTTP method

$handler : object

object wich handles request

$function : string

controller's function name

Return values
array<string|int, mixed>

built route data

handleException()

Method processes exception.

public handleException(Exception $e) : void
Parameters
$e : Exception

Exception object.

Return values
void

loadRoute()

Method loads single route

public loadRoute(array<string|int, mixed> $route) : void
Parameters
$route : array<string|int, mixed>

Route settings

Return values
void

loadRoutes()

Method loads routes

public loadRoutes(array<string|int, mixed> $routes) : void
Parameters
$routes : array<string|int, mixed>

List of routes

Return values
void

loadRoutesFromConfig()

Method loads routes from config file in *.php or *.json format

public loadRoutesFromConfig(string $configPath) : void
Parameters
$configPath : string

Path of the config for routes

Return values
void

loadRoutesFromConfigs()

Method loads list of configs

public loadRoutesFromConfigs(array<string|int, mixed> $configPaths) : void
Parameters
$configPaths : array<string|int, mixed>

paths to config files

Return values
void

loadRoutesFromDirectory()

Method loads routes from the directory

public loadRoutesFromDirectory(string $directory) : void
Parameters
$directory : string

path to the directory. Scanninng is recursive.

Return values
void

redirectTo()

Method redirects user to another page

public redirectTo(string $url) : void
Parameters
$url : string

New page

Return values
void

routeExists()

Method validates that route exists

public routeExists(string $route) : bool
Parameters
$route : string

route

Return values
bool

true if the route exists

run()

Running application

public run() : void
Return values
void

ajaxRequestError()

Method finishes ajax requests processing

protected ajaxRequestError(string $message[, int $code = -1 ]) : void
Parameters
$message : string

Error message

$code : int = -1

Error code

Return values
void

ajaxRequestResult()

Method finishes ajax requests processing and returns result

protected ajaxRequestResult(mixed $result) : void
Parameters
$result : mixed
Return values
void

ajaxRequestSuccess()

Method finishes ajax requests processing

protected ajaxRequestSuccess() : void
Return values
void

callRoute()

Method calls route and returns it's content

protected callRoute() : mixed
Return values
mixed

route processing result

formatCallStack()

Formatting call stack

protected formatCallStack(mixed $e) : array<string|int, mixed>
Parameters
$e : mixed

Exception object

Return values
array<string|int, mixed>

Search results

    Яндекс.Метрика