Methods summary
public static
MvcCore\Application
|
#
GetInstance( )
Returns singleton \MvcCore\Application instance as reference.
Returns singleton \MvcCore\Application instance as reference.
Returns
|
public
|
#
GetCompiled( )
Get if application is running as standard php project or as single file application.
It should has values from:
- \MvcCore\IApplication::COMPILED_PHP
- \MvcCore\IApplication::COMPILED_PHAR
- \MvcCore\IApplication::COMPILED_SFU
- \MvcCore\IApplication::NOT_COMPILED
Read more about every mode in interface: \MvcCore\IApplication .
Get if application is running as standard php project or as single file application.
It should has values from:
- \MvcCore\IApplication::COMPILED_PHP
- \MvcCore\IApplication::COMPILED_PHAR
- \MvcCore\IApplication::COMPILED_SFU
- \MvcCore\IApplication::NOT_COMPILED
Read more about every mode in interface: \MvcCore\IApplication .
Var
string
|
public
MvcCore\Environment |string
|
#
GetEnvironmentClass( )
Get application environment class implementing \MvcCore\IEnvironment .
Class to detect and manage environment name.
Get application environment class implementing \MvcCore\IEnvironment .
Class to detect and manage environment name.
Returns
|
public
MvcCore\Config |string
|
#
GetConfigClass( )
Get application config class implementing \MvcCore\IConfig .
Class to load and parse (system) config(s).
Get application config class implementing \MvcCore\IConfig .
Class to load and parse (system) config(s).
Returns
|
public
MvcCore\Controller |string
|
#
GetControllerClass( )
Get application config class implementing \MvcCore\IController .
Class to create default controller for request targeting views only
and to handle small assets inside packed application.
Get application config class implementing \MvcCore\IController .
Class to create default controller for request targeting views only
and to handle small assets inside packed application.
Returns
|
public
MvcCore\Debug |string
|
#
GetDebugClass( )
Get application debug class implementing \MvcCore\IDebug .
Class to handle any application error to render the error in browser or log in HDD.
Get application debug class implementing \MvcCore\IDebug .
Class to handle any application error to render the error in browser or log in HDD.
Returns
|
public
MvcCore\Request |string
|
#
GetRequestClass( )
Get application request class implementing \MvcCore\IRequest .
Class to create describing HTTP request object.
Get application request class implementing \MvcCore\IRequest .
Class to create describing HTTP request object.
Returns
|
public
MvcCore\Response |string
|
#
GetResponseClass( )
Get application response class implementing \MvcCore\IResponse .
Class to create HTTP response object to store response headers and response content.
Get application response class implementing \MvcCore\IResponse .
Class to create HTTP response object to store response headers and response content.
Returns
|
public
MvcCore\Route |string
|
#
GetRouteClass( )
Get application route class implementing \MvcCore\IRoute .
Class to describe single route with match and replace pattern,
controller, action, params default values and params constraints.
Get application route class implementing \MvcCore\IRoute .
Class to describe single route with match and replace pattern,
controller, action, params default values and params constraints.
Returns
|
public
MvcCore\Router |string
|
#
GetRouterClass( )
Get application router class implementing \MvcCore\IRouter .
Class to store all routes, dispatch request by routes and generate URL addresses by routes.
Get application router class implementing \MvcCore\IRouter .
Class to store all routes, dispatch request by routes and generate URL addresses by routes.
Returns
|
public
MvcCore\Session |string
|
#
GetSessionClass( )
Get application session class implementing \MvcCore\ISession .
Class to configure session namespaces, session opening, writing and expirations.
Get application session class implementing \MvcCore\ISession .
Class to configure session namespaces, session opening, writing and expirations.
Returns
|
public
MvcCore\Tool |string
|
#
GetToolClass( )
Get application tool class implementing \MvcCore\ITool .
Class to handle helper calls from MvcCore core modules.
Get application tool class implementing \MvcCore\ITool .
Class to handle helper calls from MvcCore core modules.
Returns
|
public
MvcCore\View |string
|
#
GetViewClass( )
Get application view class implementing \MvcCore\IView .
Class to prepare and render controller view, sub-views and wrapper layout.
Get application view class implementing \MvcCore\IView .
Class to prepare and render controller view, sub-views and wrapper layout.
Returns
|
public
|
#
GetEnvironment( )
Returns environment detection instance.
Returns environment detection instance.
Var
\MvcCore\Environment
|
public
MvcCore\Controller
|
#
GetController( )
Returns currently dispatched controller instance.
Returns currently dispatched controller instance.
Returns
|
public
MvcCore\Request
|
#
GetRequest( )
Returns currently used request instance.
Returns currently used request instance.
Returns
|
public
MvcCore\Response
|
#
GetResponse( )
Returns currently used response instance.
Returns currently used response instance.
Returns
|
public
MvcCore\Router
|
#
GetRouter( )
Returns currently used router instance.
Returns currently used router instance.
Returns
|
public
string
|
#
GetAppDir( )
Get application scripts and views directory name as "App" by default,
where are following subdirectories by default:
- /App/Controllers
- /App/Models
- /App/Views
It should by reconfigured to custom value in the very application beginning.
Get application scripts and views directory name as "App" by default,
where are following subdirectories by default:
- /App/Controllers
- /App/Models
- /App/Views
It should by reconfigured to custom value in the very application beginning.
Returns
string
|
public
string
|
#
GetControllersDir( )
Get controllers directory name as "Controllers" by default, for all controller classes,
it's placed directly in application directory by default.
It should by reconfigured to custom value in the very application beginning.
Get controllers directory name as "Controllers" by default, for all controller classes,
it's placed directly in application directory by default.
It should by reconfigured to custom value in the very application beginning.
Returns
string
|
public
string
|
#
GetViewsDir( )
Get views directory name as "views" by default, for all view elements,
it's placed directly in application directory above by default.
It should by reconfigured to custom value in the very application beginning.
Get views directory name as "views" by default, for all view elements,
it's placed directly in application directory above by default.
It should by reconfigured to custom value in the very application beginning.
Returns
string
|
public
string[]
|
#
GetDefaultControllerAndActionNames( )
Returns array with:
- 0 => "index" - Default controller name, from protected \MvcCore\Application::$defaultControllerName .
- 1 => "index" - Default action name, from protected \MvcCore\Application::$defaultControllerDefaultActionName .
Returns array with:
- 0 => "index" - Default controller name, from protected \MvcCore\Application::$defaultControllerName .
- 1 => "index" - Default action name, from protected \MvcCore\Application::$defaultControllerDefaultActionName .
Returns
string[]
|
public
MvcCore\Application
|
#
SetCompiled( string $compiled = '' )
Set if application is running as standard php project or as single file application.
First param $compiled should has values from:
- \MvcCore\IApplication::COMPILED_PHP
- \MvcCore\IApplication::COMPILED_PHAR
- \MvcCore\IApplication::COMPILED_SFU
- \MvcCore\IApplication::NOT_COMPILED
Read more about every mode in interface: \MvcCore\IApplication .
Core configuration method.
Set if application is running as standard php project or as single file application.
First param $compiled should has values from:
- \MvcCore\IApplication::COMPILED_PHP
- \MvcCore\IApplication::COMPILED_PHAR
- \MvcCore\IApplication::COMPILED_SFU
- \MvcCore\IApplication::NOT_COMPILED
Read more about every mode in interface: \MvcCore\IApplication .
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetEnvironmentClass( string $environmentClass )
Set application environment class implementing \MvcCore\IEnvironment .
Class to detect and manage environment name.
Core configuration method.
Set application environment class implementing \MvcCore\IEnvironment .
Class to detect and manage environment name.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetConfigClass( string $configClass )
Set application config class implementing \MvcCore\IConfig .
Class to load and parse (system) config(s).
Core configuration method.
Set application config class implementing \MvcCore\IConfig .
Class to load and parse (system) config(s).
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetControllerClass( string $controllerClass )
Set application controller class implementing \MvcCore\IController .
Class to create default controller for request targeting views only
and to handle small assets inside packed application.
Core configuration method.
Set application controller class implementing \MvcCore\IController .
Class to create default controller for request targeting views only
and to handle small assets inside packed application.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetDebugClass( string $debugClass )
Set application debug class implementing \MvcCore\IDebug .
Class to handle any application error to render the error in browser or log in HDD.
Core configuration method.
Set application debug class implementing \MvcCore\IDebug .
Class to handle any application error to render the error in browser or log in HDD.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetRequestClass( string $requestClass )
Set application request class implementing \MvcCore\IRequest .
Class to create describing HTTP request object.
Core configuration method.
Set application request class implementing \MvcCore\IRequest .
Class to create describing HTTP request object.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetResponseClass( string $responseClass )
Set application response class implementing \MvcCore\IResponse .
Class to create HTTP response object to store response headers and response content.
Core configuration method.
Set application response class implementing \MvcCore\IResponse .
Class to create HTTP response object to store response headers and response content.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetRouteClass( string $routerClass )
Set application route class implementing \MvcCore\IRoute .
Class to describe single route with match and replace pattern,
controller, action, params default values and params constraints.
Core configuration method.
Set application route class implementing \MvcCore\IRoute .
Class to describe single route with match and replace pattern,
controller, action, params default values and params constraints.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetRouterClass( string $routerClass )
Set application router class implementing \MvcCore\IRouter .
Class to store all routes, dispatch request by routes and generate URL addresses by routes.
Core configuration method.
Set application router class implementing \MvcCore\IRouter .
Class to store all routes, dispatch request by routes and generate URL addresses by routes.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetSessionClass( string $sessionClass )
Set application session class implementing \MvcCore\ISession .
Class to configure session namespaces, session opening, writing and expirations.
Core configuration method.
Set application session class implementing \MvcCore\ISession .
Class to configure session namespaces, session opening, writing and expirations.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetToolClass( string $toolClass )
Set application tool class implementing \MvcCore\ITool .
Class to handle helper calls from MvcCore core modules.
Core configuration method.
Set application tool class implementing \MvcCore\ITool .
Class to handle helper calls from MvcCore core modules.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetViewClass( string $viewClass )
Set application view class implementing \MvcCore\IView .
Class to prepare and render controller view, sub-views and wrapper layout.
Core configuration method.
Set application view class implementing \MvcCore\IView .
Class to prepare and render controller view, sub-views and wrapper layout.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
|
public
MvcCore\Application
|
#
SetAppDir( string $appDir )
Set application scripts and views directory name ("App" by default),
where are following subdirectories by default:
- /App/Controllers
- /App/Models
- /App/Views
It should by reconfigured to custom value in the very application beginning.
Core configuration method.
Set application scripts and views directory name ("App" by default),
where are following subdirectories by default:
- /App/Controllers
- /App/Models
- /App/Views
It should by reconfigured to custom value in the very application beginning.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetControllersDir( string $controllersDir )
Set controllers directory name ("Controllers" by default), for all controller classes,
it's placed directly in application directory by default.
It should by reconfigured to custom value in the very application beginning.
Core configuration method.
Set controllers directory name ("Controllers" by default), for all controller classes,
it's placed directly in application directory by default.
It should by reconfigured to custom value in the very application beginning.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetViewsDir( string $viewsDir )
Set views directory name ("views" by default), for all view elements,
it's placed directly in application directory above by default.
It should by reconfigured to custom value in the very application beginning.
Core configuration method.
Set views directory name ("views" by default), for all view elements,
it's placed directly in application directory above by default.
It should by reconfigured to custom value in the very application beginning.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetDefaultControllerName( string $defaultControllerName )
Set default controller name. "Index" value by default.
Core configuration method.
Set default controller name. "Index" value by default.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetDefaultControllerDefaultActionName( string $defaultActionName )
Set default controller default action name. "Index" value by default.
Core configuration method.
Set default controller default action name. "Index" value by default.
Core configuration method.
Parameters
Returns
|
public
MvcCore\Application
|
#
SetDefaultControllerErrorActionName( string $defaultControllerErrorActionName )
Set default controller common error action name. "Error" value by default.
Core configuration method.
Set default controller common error action name. "Error" value by default.
Core configuration method.
Parameters
- $defaultControllerErrorActionName
Returns
|
public
MvcCore\Application
|
#
SetDefaultControllerNotFoundActionName( string $defaultControllerNotFoundActionName )
Set default controller not found error action name. "NotFound" value by default.
Core configuration method.
Set default controller not found error action name. "NotFound" value by default.
Core configuration method.
Parameters
- $defaultControllerNotFoundActionName
Returns
|
public
MvcCore\Application
|
#
AddPreRouteHandler( callable $handler, integer|null $priorityIndex = NULL )
Add pre route handler into pre route handlers queue to process them after
every request has been completed into \MvcCore\Request describing object and before
every request will be routed by \MvcCore\Router::Route(); call.
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPreRouteHandler(function(
\MvcCore\Request $request,
\MvcCore\Response $response
) {
$request->customVar = 'custom_value';
});
Add pre route handler into pre route handlers queue to process them after
every request has been completed into \MvcCore\Request describing object and before
every request will be routed by \MvcCore\Router::Route(); call.
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPreRouteHandler(function( \MvcCore\Request $request, \MvcCore\Response $response
) { $request->customVar = 'custom_value';
});
Parameters
Returns
|
public
MvcCore\Application
|
#
AddPostRouteHandler( callable $handler, integer|null $priorityIndex = NULL )
Add post route handler into post route handlers queue to process them after
every request has been completed into \MvcCore\Request describing object, after
every request has been routed by \MvcCore\Router::Route(); call and before
every request has created target controller instance.
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPostRouteHandler(function(
\MvcCore\Request $request,
\MvcCore\Response $response
) {
$request->customVar = 'custom_value';
});
Add post route handler into post route handlers queue to process them after
every request has been completed into \MvcCore\Request describing object, after
every request has been routed by \MvcCore\Router::Route(); call and before
every request has created target controller instance.
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPostRouteHandler(function( \MvcCore\Request $request, \MvcCore\Response $response
) { $request->customVar = 'custom_value';
});
Parameters
Returns
|
public
MvcCore\Application
|
#
AddPreDispatchHandler( callable $handler, integer|null $priorityIndex = NULL )
Add pre dispatch handler into pre dispatch handlers queue to process them after
every request has been routed by \MvcCore\Router::Route(); call, after
every request has been dispatched by \MvcCore\Controller::Dispatch(); and
after every request has created and prepared target controller instance to dispatch.
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPreDispatchHandler(function(
\MvcCore\Request $request,
\MvcCore\Response $response
) {
$request->customVar = 'custom_value';
});
Add pre dispatch handler into pre dispatch handlers queue to process them after
every request has been routed by \MvcCore\Router::Route(); call, after
every request has been dispatched by \MvcCore\Controller::Dispatch(); and
after every request has created and prepared target controller instance to dispatch.
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPreDispatchHandler(function( \MvcCore\Request $request, \MvcCore\Response $response
) { $request->customVar = 'custom_value';
});
Parameters
Returns
|
public
MvcCore\Application
|
#
AddPostDispatchHandler( callable $handler, integer|null $priorityIndex = NULL )
Add post dispatch handler into post dispatch handlers queue to process them
before every request is terminated by \MvcCore\Application::Terminate(); .
Every request terminated sooner has executed this post dispatch handlers queue.
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPostDispatchHandler(function(
\MvcCore\Request $request,
\MvcCore\Response $response
) {
$request->customVar = 'custom_value';
});
Add post dispatch handler into post dispatch handlers queue to process them
before every request is terminated by \MvcCore\Application::Terminate(); .
Every request terminated sooner has executed this post dispatch handlers queue.
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPostDispatchHandler(function( \MvcCore\Request $request, \MvcCore\Response $response
) { $request->customVar = 'custom_value';
});
Parameters
Returns
|
public
MvcCore\Application
|
#
AddPostTerminateHandler( callable $handler, integer|null $priorityIndex = NULL )
Add post terminate handler into post terminate handlers queue to process them
after every request is terminated by \MvcCore\Application::Terminate(); .
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPostTerminateHandler(function(
\MvcCore\Request $request,
\MvcCore\Response $response
) {
// close connection by previously configured
// header: header('Connection: close');
// and run background process now:
});
Add post terminate handler into post terminate handlers queue to process them
after every request is terminated by \MvcCore\Application::Terminate(); .
Callable should be void and it's params should be two with following types:
- \MvcCore\Request
- \MvcCore\Response
Example:
\MvcCore\Application::GetInstance()->AddPostTerminateHandler(function( \MvcCore\Request $request, \MvcCore\Response $response
) { // close connection by previously configured // header: header('Connection: close'); // and run background process now:
});
Parameters
Returns
|
public
MvcCore\Application
|
#
Dispatch( )
Dispatch http request/response.
- 1. Complete and init:
- Complete describing environment object \MvcCore\Request .
- Complete describing request object \MvcCore\Request .
- Complete response storage object \MvcCore\Response .
- Init debugging and logging by \MvcCore\Debug::Init(); .
- 2. (Process pre-route handlers queue.)
- 3. Route request by your router or with \MvcCore\Router::Route() by default.
- 4. (Process post-route handlers queue.)
- 5. Create and set up controller instance.
- 6. (Process pre-dispatch handlers queue.)
- 7. Dispatch controller life-cycle.
- Call \MvcCore\Controller::Init() and \MvcCore\Controller::PreDispatch() .
- Call routed action method.
- Call \MvcCore\Controller::Render() to render all views.
- 6. Terminate request:
- (Process post-dispatch handlers queue.)
- Write session in register_shutdown_function() handler.
- Send response headers if possible and echo response body.
Dispatch http request/response.
- 1. Complete and init: - Complete describing environment object \MvcCore\Request . - Complete describing request object \MvcCore\Request . - Complete response storage object \MvcCore\Response . - Init debugging and logging by \MvcCore\Debug::Init(); .
- 2. (Process pre-route handlers queue.)
- 3. Route request by your router or with \MvcCore\Router::Route() by default.
- 4. (Process post-route handlers queue.)
- 5. Create and set up controller instance.
- 6. (Process pre-dispatch handlers queue.)
- 7. Dispatch controller life-cycle. - Call \MvcCore\Controller::Init() and \MvcCore\Controller::PreDispatch() . - Call routed action method. - Call \MvcCore\Controller::Render() to render all views.
- 6. Terminate request: - (Process post-dispatch handlers queue.) - Write session in register_shutdown_function() handler. - Send response headers if possible and echo response body.
Returns
|
public
|
#
SessionStart( )
Starts a session, standardly called from \MvcCore\Controller::Init(); .
But is should be called anytime sooner, for example in any pre request handler
to redesign request before MVC dispatching or anywhere else.
Starts a session, standardly called from \MvcCore\Controller::Init(); .
But is should be called anytime sooner, for example in any pre request handler
to redesign request before MVC dispatching or anywhere else.
|
public
boolean
|
#
RouteRequest( )
Route request by router obtained by default by calling:
\MvcCore\Router::GetInstance(); .
Store requested route inside configured
router class to get it later by calling:
\MvcCore\Router::GetCurrentRoute();
Route request by router obtained by default by calling:
\MvcCore\Router::GetInstance(); .
Store requested route inside configured
router class to get it later by calling:
\MvcCore\Router::GetCurrentRoute();
Returns
boolean
|
public
boolean
|
#
ProcessCustomHandlers( callable[] & $handlers = [] )
Process pre-route, pre-request or post-dispatch
handlers queue by queue index. Call every handler in queue
in try catch mode to catch any exceptions to call:
\MvcCore\Application::DispatchException($e); .
Process pre-route, pre-request or post-dispatch
handlers queue by queue index. Call every handler in queue
in try catch mode to catch any exceptions to call:
\MvcCore\Application::DispatchException($e); .
Parameters
Returns
boolean
|
public
boolean
|
#
DispatchRequest( )
If controller class exists - try to dispatch controller,
if only view file exists - try to render targeted view file
with configured core controller instance (\MvcCore\Controller by default).
If controller class exists - try to dispatch controller,
if only view file exists - try to render targeted view file
with configured core controller instance (\MvcCore\Controller by default).
Returns
boolean
|
public
boolean
|
#
DispatchControllerAction( string $controllerClassFullName, string $actionNamePc, string $viewScriptFullPath, callable $exceptionCallback )
Dispatch controller by:
- By full class name and by action name
- Or by view script full path
Call exception callback if there is caught any
exception in controller life-cycle dispatching process
with first argument as caught exception.
Dispatch controller by:
- By full class name and by action name
- Or by view script full path
Call exception callback if there is caught any
exception in controller life-cycle dispatching process
with first argument as caught exception.
Parameters
- $controllerClassFullName
- $ctrlClassFullName
- $actionNamePc
- $viewScriptFullPath
- $exceptionCallback
Returns
boolean
|
public
string
|
#
Url( string $controllerActionOrRouteName = 'Index:Index', array $params = [] )
Generates url:
- By "Controller:Action" name and params array
(for routes configuration when routes array has keys with "Controller:Action" strings
and routes has not controller name and action name defined inside).
- By route name and params array
(route name is key in routes configuration array, should be any string
but routes must have information about controller name and action name inside).
Result address (url string) should have two forms:
- Nice rewritten URL by routes configuration
(for apps with URL rewrite support (Apache .htaccess or IIS URL rewrite module)
and when first param is key in routes configuration array).
- For all other cases is URL form like: "index.php?controller=ctrlName&action=actionName"
(when first param is not founded in routes configuration array).
Generates url:
- By "Controller:Action" name and params array (for routes configuration when routes array has keys with "Controller:Action" strings and routes has not controller name and action name defined inside).
- By route name and params array (route name is key in routes configuration array, should be any string but routes must have information about controller name and action name inside).
Result address (url string) should have two forms:
- Nice rewritten URL by routes configuration (for apps with URL rewrite support (Apache .htaccess or IIS URL rewrite module) and when first param is key in routes configuration array).
- For all other cases is URL form like: "index.php?controller=ctrlName&action=actionName" (when first param is not founded in routes configuration array).
Parameters
- $controllerActionOrRouteName
- Should be
"Controller:Action" combination or just any route name as custom specific string.
- $params
- Optional, array with params, key is param name, value is param value.
Returns
string
|
public
MvcCore\Application
|
#
Terminate( )
Terminate request.
The only place in application where is called echo '....' without output buffering.
- Process post-dispatch handlers queue.
- Write session through registered handler into register_shutdown_function() .
- Send HTTP headers (if still possible).
- Echo response body.
This method is always called INTERNALLY after controller
life-cycle has been dispatched. But you can use it any
time sooner for custom purposes.
Terminate request.
The only place in application where is called echo '....' without output buffering.
- Process post-dispatch handlers queue.
- Write session through registered handler into register_shutdown_function() .
- Send HTTP headers (if still possible).
- Echo response body.
This method is always called INTERNALLY after controller
life-cycle has been dispatched. But you can use it any
time sooner for custom purposes.
Returns
|
public
boolean
|
#
DispatchException( Exception|string $exceptionOrMessage, integer|null $code = NULL )
Dispatch caught exception:
- If request is processing PHP package packing to determinate current script dependencies:
- Do not log or render nothing.
- If request is production mode:
- Print exception in browser.
- If request is not in development mode:
- Log error and try to render error page by configured controller and error action:,
\App\Controllers\Index::Error(); by default.
Dispatch caught exception:
- If request is processing PHP package packing to determinate current script dependencies: - Do not log or render nothing.
- If request is production mode: - Print exception in browser.
- If request is not in development mode: - Log error and try to render error page by configured controller and error action:, \App\Controllers\Index::Error(); by default.
Parameters
- $exceptionOrMessage
- $code
Returns
boolean
|
public
boolean
|
#
RenderError( Exception $e )
Render error by configured default controller and error action,
\App\Controllers\Index::Error(); by default.
If there is no controller/action like that or any other exception happens,
it's processed very simple plain text response with 500 http code.
Render error by configured default controller and error action,
\App\Controllers\Index::Error(); by default.
If there is no controller/action like that or any other exception happens,
it's processed very simple plain text response with 500 http code.
Parameters
Returns
boolean
|
public
boolean
|
#
RenderNotFound( Exception $exceptionMessage = '' )
Render error by configured default controller and not found error action,
\App\Controllers\Index::NotFound(); by default.
If there is no controller/action like that or any other exception happens,
it's processed very simple plain text response with 404 http code.
Render error by configured default controller and not found error action,
\App\Controllers\Index::NotFound(); by default.
If there is no controller/action like that or any other exception happens,
it's processed very simple plain text response with 404 http code.
Parameters
Returns
boolean
|
public
boolean
|
#
RenderError500PlainText( string $text = '' )
Prepare very simple response with internal server error (500)
as plain text response into \MvcCore\Application::$response .
Prepare very simple response with internal server error (500)
as plain text response into \MvcCore\Application::$response .
Parameters
Returns
boolean
|
public
boolean
|
#
RenderError404PlainText( string $text,… )
Prepare very simple response with not found error (404)
as plain text response into \MvcCore\Application::$response .
Prepare very simple response with not found error (404)
as plain text response into \MvcCore\Application::$response .
Parameters
Returns
boolean
|
public
string
|
#
GetDefaultControllerIfHasAction( string $actionName )
Check if default application controller (\App\Controllers\Index by default) has specific action.
If default controller has specific action - return default controller full name, else empty string.
Check if default application controller (\App\Controllers\Index by default) has specific action.
If default controller has specific action - return default controller full name, else empty string.
Parameters
Returns
string
|
public
string
|
#
CompleteControllerName( string $controllerNamePascalCase )
Complete standard MvcCore application controller full name in form:
\App\Controllers\<$controllerNamePascalCase> .
Complete standard MvcCore application controller full name in form:
\App\Controllers\<$controllerNamePascalCase> .
Parameters
- $controllerNamePascalCase
Returns
string
|
public
boolean
|
#
IsErrorDispatched( )
Return TRUE if current request is default controller error action dispatching process.
Return TRUE if current request is default controller error action dispatching process.
Returns
boolean
|
public
boolean
|
#
IsNotFoundDispatched( )
Return TRUE if current request is default controller not found error action dispatching process.
Return TRUE if current request is default controller not found error action dispatching process.
Returns
boolean
|