Class Core
Core of the ICanBoogie framework.
-
ICanBoogie\Core
uses
ICanBoogie\PrototypeTrait (not available)
ICanBoogie\Binding\Event\ApplicationBindings (not available)
ICanBoogie\Binding\HTTP\ApplicationBindings (not available)
ICanBoogie\Binding\Routing\ApplicationBindings (not available)
Abstract
Namespace: ICanBoogie
Located at Core.php
Methods summary
protected
get_is_booting( void )
: boolean
Whether the application is booting.
Whether the application is booting.
Returns
boolean
true
if the application is booting, false
otherwise.
protected
get_is_booted( void )
: boolean
Whether the application is booted.
Whether the application is booted.
Returns
boolean
true
if the application is booted, false
otherwise.
protected
get_is_running( void )
: boolean
Whether the application is running.
Whether the application is running.
Returns
boolean
true
if the application is running, false
otherwise.
public static
get( void )
: Application
Returns the unique instance of the application.
Returns the unique instance of the application.
Returns
Application
public
__construct( array $options
= [] )
Constructor.
Parameters
$options
- Initial options to create the application.
Throws
public
assert_not_booted( void )
Asserts that the application is not booted yet.
Asserts that the application is not booted yet.
Throws
public
assert_not_running( void )
Asserts that the application is not running yet.
Asserts that the application is not running yet.
Throws
protected
create_config_manager( array $paths
, array $synthesizers
)
: Config
Returns configuration manager.
Returns configuration manager.
Parameters
$paths
- Path list.
$synthesizers
- Configuration synthesizers.
Returns
Config
protected
apply_config( array $config
)
Applies low-level configuration.
Applies low-level configuration.
Parameters
protected
create_storage( string|callable $engine
)
: ICanBoogie\Storage\Storage
Creates a storage engine.
Creates a storage engine.
Parameters
$engine
- A class name or a callable.
Returns
ICanBoogie\Storage\Storage
protected
create_storage_for_configs( string|callable $engine
)
: ICanBoogie\Storage\Storage
Creates storage engine for synthesized configs.
Creates storage engine for synthesized configs.
Parameters
$engine
- A class name or a callable.
Returns
ICanBoogie\Storage\Storage
protected
get_storage_for_configs( void )
: ICanBoogie\Storage\Storage
Returns
ICanBoogie\Storage\Storage
protected
create_storage_for_vars( string|callable $engine
)
: ICanBoogie\Storage\Storage
Creates storage engine for variables.
Creates storage engine for variables.
Parameters
$engine
- A class name or a callable.
Returns
ICanBoogie\Storage\Storage
protected
lazy_get_vars( void )
: ICanBoogie\Storage\Storage
Returns the non-volatile variables registry.
Returns the non-volatile variables registry.
Returns
ICanBoogie\Storage\Storage
protected
lazy_get_config( void )
: array
Returns the app
configuration.
Returns the app
configuration.
Returns
array
protected
set_timezone( TimeZone|string|integer $timezone
)
Sets the working time zone.
Sets the working time zone.
When the time zone is set the default time zone is also set with
date_default_timezone_set().
Parameters
$timezone
An instance of TimeZone,
the name of a time zone, or numeric equivalent e.g. 3600.
protected
get_timezone( void )
: TimeZone
Returns the working time zone.
Returns the working time zone.
If the time zone is not defined yet it defaults to the value of
date_default_timezone_get() or "UTC".
Returns
TimeZone
protected
change_status( integer $status
, callable $callable
)
: mixed
Changes the status of the application.
Changes the status of the application.
Parameters
Returns
mixed
public
boot( void )
Boot the modules and configure Debug, Prototype and Events.
Boot the modules and configure Debug, Prototype and Events.
The boot
event of class Core\BootEvent is fired after the boot is finished.
The ICANBOOGIE_READY_TIME_FLOAT
key is added to the $_SERVER
super global with the
micro-time at which the boot finished.
Throws
public
__invoke( ICanBoogie\HTTP\Request $request
= null )
Run the application.
In order to avoid error messages triggered by PHP fatal errors to be send with a 200 (Ok)
HTTP code, the HTTP code is changed to 500 before the application is run (and booted). When
the process runs properly the HTTP code is changed to the appropriate value by the response.
The ICanBoogie\Core::boot()
method is invoked if the application has not booted yet.
Parameters
$request
- The request to handle. If
null
, the initial request is used.
public
clear_cache( void )
Fires the ICanBoogie\Application::clear_cache
event.
Fires the ICanBoogie\Application::clear_cache
event.
protected
run( ICanBoogie\HTTP\Request $request
)
Fires the ICanBoogie\Application::run
event.
Fires the ICanBoogie\Application::run
event.
Parameters
protected
terminate( ICanBoogie\HTTP\Request $request
, ICanBoogie\HTTP\Response $response
)
Terminate the application.
Constants summary
STATUS_VOID
: integer
Status of the application.
Status of the application.
0
STATUS_INSTANTIATING
: integer
1
STATUS_INSTANTIATED
: integer
2
STATUS_CONFIGURING
: integer
3
STATUS_BOOTING
: integer
5
STATUS_BOOTED
: integer
6
STATUS_RUNNING
: integer
7
STATUS_TERMINATED
: integer
8
Properties summary
Magic properties
public
$vars
: ICanBoogie\Storage\Storage
Persistent variables registry.
public
$session
: Session
public
$language
: string
public
$timezone
: string|integer
public read-only
$is_booting
: boolean
true
if the application is booting, false
otherwise.
public read-only
$is_booted
: boolean
true
if the application is booted, false
otherwise.
public read-only
$is_running
: boolean
true
if the application is running, false
otherwise.
public read-only
$storage_for_configs
: ICanBoogie\Storage\Storage