Application
Base class for any application.
Table of Contents
Constants
- JOB_PRIORITY_LOW = 50
- JOB_PRIORITY_NORMAL = 100
Methods
- addBackgroundJob() : $this
- Adds a job to do after the response was sent.
- createExceptionHandlerLog() : mixed
- createExceptionHandlerOutput() : mixed
- end() : void
- Ends work of application.
- getCache() : Cache
- Returns new instance of the Cache object.
- getCompositeSessionManager() : CompositeSessionManager
- getConnection() : Connection|Connection
- Static method returns database connection for the specified name.
- getConnectionPool() : ConnectionPool
- Returns database connections pool object.
- getContext() : Context|HttpContext
- Returns context of the current request.
- getCurrentRoute() : Route
- getDocumentRoot() : null|string
- Returns server document root.
- getExceptionHandler() : ExceptionHandler
- getInstance() : Application|HttpApplication
- Returns current instance of the Application.
- getKernelSession() : SessionInterface
- getLicense() : License
- getLocalSession() : SessionLocalStorage
- getManagedCache() : ManagedCache
- Returns manager of the managed cache.
- getPersonalRoot() : null|string
- Returns personal root directory (relative to document root)
- getRouter() : Router
- getSession() : SessionInterface
- getSessionLocalStorageManager() : SessionLocalStorageManager
- getTaggedCache() : TaggedCache
- Returns manager of the managed cache.
- getUserTypeManager() : CUserTypeManager
- Returns UF manager.
- hasCurrentRoute() : bool
- hasInstance() : bool
- initializeBasicKernel() : mixed
- initializeExtendedKernel() : mixed
- Does full kernel initialization. Should be called somewhere after initializeBasicKernel().
- isInitialized() : bool
- Returns true if the application is fully initialized.
- isUtfMode() : true
- Returns true if server is in UTF-8 mode. False - otherwise.
- resetAccelerator() : mixed
- Resets accelerator if any.
- run() : void
- Runs controller and its action and sends response to the output.
- setContext() : mixed
- Modifies context of the current request.
- setCurrentRoute() : void
- setRouter() : void
- start() : mixed
- Starts request execution. Should be called after initialize.
- terminate() : void
- Terminates application by invoking exit().
Constants
JOB_PRIORITY_LOW
public
mixed
JOB_PRIORITY_LOW
= 50
JOB_PRIORITY_NORMAL
public
mixed
JOB_PRIORITY_NORMAL
= 100
Methods
addBackgroundJob()
Adds a job to do after the response was sent.
public
addBackgroundJob(callable $job[, array<string|int, mixed> $args = [] ][, int $priority = \self::JOB_PRIORITY_NORMAL ]) : $this
Parameters
- $job : callable
- $args : array<string|int, mixed> = []
- $priority : int = \self::JOB_PRIORITY_NORMAL
Return values
$thiscreateExceptionHandlerLog()
public
createExceptionHandlerLog() : mixed
createExceptionHandlerOutput()
public
createExceptionHandlerOutput() : mixed
end()
Ends work of application.
public
end([int $status = 0 ][, Response|null $response = null ]) : void
Sends response and then terminates execution. If there is no $response the method will use Context::$response.
Parameters
- $status : int = 0
- $response : Response|null = null
getCache()
Returns new instance of the Cache object.
public
getCache() : Cache
Return values
CachegetCompositeSessionManager()
public
final getCompositeSessionManager() : CompositeSessionManager
Return values
CompositeSessionManagergetConnection()
Static method returns database connection for the specified name.
public
static getConnection([string $name = "" ]) : Connection|Connection
If name is empty - default connection is returned.
Parameters
- $name : string = ""
-
Name of database connection. If empty - default connection.
Tags
Return values
Connection|ConnectiongetConnectionPool()
Returns database connections pool object.
public
getConnectionPool() : ConnectionPool
Return values
ConnectionPoolgetContext()
Returns context of the current request.
public
getContext() : Context|HttpContext
Return values
Context|HttpContextgetCurrentRoute()
public
getCurrentRoute() : Route
Return values
RoutegetDocumentRoot()
Returns server document root.
public
static getDocumentRoot() : null|string
Return values
null|stringgetExceptionHandler()
public
getExceptionHandler() : ExceptionHandler
Return values
ExceptionHandlergetInstance()
Returns current instance of the Application.
public
static getInstance() : Application|HttpApplication
Return values
Application|HttpApplicationgetKernelSession()
public
final getKernelSession() : SessionInterface
Return values
SessionInterfacegetLicense()
public
getLicense() : License
Return values
LicensegetLocalSession()
public
final getLocalSession(mixed $name) : SessionLocalStorage
Parameters
- $name : mixed
Return values
SessionLocalStoragegetManagedCache()
Returns manager of the managed cache.
public
getManagedCache() : ManagedCache
Return values
ManagedCachegetPersonalRoot()
Returns personal root directory (relative to document root)
public
static getPersonalRoot() : null|string
Return values
null|stringgetRouter()
public
getRouter() : Router
Return values
RoutergetSession()
public
final getSession() : SessionInterface
Return values
SessionInterfacegetSessionLocalStorageManager()
public
final getSessionLocalStorageManager() : SessionLocalStorageManager
Return values
SessionLocalStorageManagergetTaggedCache()
Returns manager of the managed cache.
public
getTaggedCache() : TaggedCache
Return values
TaggedCachegetUserTypeManager()
Returns UF manager.
public
static getUserTypeManager() : CUserTypeManager
Return values
CUserTypeManagerhasCurrentRoute()
public
hasCurrentRoute() : bool
Return values
boolhasInstance()
public
static hasInstance() : bool
Return values
boolinitializeBasicKernel()
public
initializeBasicKernel() : mixed
Does nothing, will be removed soon.
initializeExtendedKernel()
Does full kernel initialization. Should be called somewhere after initializeBasicKernel().
public
initializeExtendedKernel(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
-
Parameters of the current request (depends on application type)
isInitialized()
Returns true if the application is fully initialized.
public
isInitialized() : bool
Return values
boolisUtfMode()
Returns true if server is in UTF-8 mode. False - otherwise.
public
static isUtfMode() : true
Always returns true.
Return values
trueresetAccelerator()
Resets accelerator if any.
public
static resetAccelerator([string $filename = null ]) : mixed
Parameters
- $filename : string = null
run()
Runs controller and its action and sends response to the output.
public
run() : void
It's a stub method, and we can't mark it as abstract because there is compatibility.
setContext()
Modifies context of the current request.
public
setContext(Context $context) : mixed
Parameters
- $context : Context
setCurrentRoute()
public
setCurrentRoute(Route $currentRoute) : void
Parameters
- $currentRoute : Route
setRouter()
public
setRouter(Router $router) : void
Parameters
- $router : Router
start()
Starts request execution. Should be called after initialize.
public
abstract start() : mixed
Should be implemented in subclass.
terminate()
Terminates application by invoking exit().
public
terminate([int $status = 0 ]) : void
It's the right way to finish application.
Parameters
- $status : int = 0