ICanBoogie
  • Documentation
  • API Reference
  • ICanBoogie 4.0.x
Namespaces
  • ICanBoogie
    • Application
    • Autoconfig
    • Binding
    • Routing
    • Session
Classes
  • AlreadyAuthenticated
  • AppConfig
  • Core
  • Debug
  • Helpers
  • Hooks
  • Logger
  • LogLevel
  • SessionWithEvent
Interfaces
  • LoggerInterface
Traits
  • AppAccessor
  • LoggerTrait
Exceptions
  • ApplicationAlreadyBooted
  • ApplicationAlreadyInstantiated
  • ApplicationAlreadyRunning
  • ApplicationNotInstantiated

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_configured( void ) : boolean

Whether the application is configured.

Whether the application is configured.

Returns

boolean
true if the application is configured, false otherwise.
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.

Constructor.

Parameters

$options
Initial options to create the application.

Throws

ICanBoogie\ApplicationAlreadyInstantiated
in attempt to create a second instance.
public assert_not_booted( void )

Asserts that the application is not booted yet.

Asserts that the application is not booted yet.

Throws

ICanBoogie\ApplicationAlreadyBooted
if the application is already booted.
public assert_not_running( void )

Asserts that the application is not running yet.

Asserts that the application is not running yet.

Throws

ICanBoogie\ApplicationAlreadyRunning
if the application is already running.
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

$config
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

$status
$callable

Returns

mixed
protected configure( void )

Configures the application.

Configures the application.

The configure event of class Core\ConfigureEvent is fired after the application is configured. Event hooks may use this event to further configure the application.

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

ICanBoogie\ApplicationAlreadyBooted
in attempt to boot the application twice.
public __invoke( ICanBoogie\HTTP\Request $request = null )

Run the application.

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

$request
protected terminate( ICanBoogie\HTTP\Request $request, ICanBoogie\HTTP\Response $response )

Terminate the application.

Terminate the application.

Fires the ICanBoogie\Application::terminate event of class ICanBoogie\Application\TerminateEvent.

Parameters

$request
$response
protected initialize_response_header( void )

Initializes default response header.

Initializes default response header.

The default response has the ICanBoogie\Status::INTERNAL_SERVER_ERROR status code and the appropriate header fields so it is not cached. That way, if something goes wrong and an error message is displayed it won't be cached by a proxi.

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_CONFIGURED : integer
4
STATUS_BOOTING : integer
5
STATUS_BOOTED : integer
6
STATUS_RUNNING : integer
7
STATUS_TERMINATED : integer
8

Properties summary

Magic properties

public $configs : Config

Configurations manager.

public $vars : ICanBoogie\Storage\Storage

Persistent variables registry.

public $session : Session

User's session.

public $language : string

Locale language.

public $timezone : string|integer

Time zone.

public $config : array

The "app" configuration.

public read-only $is_configured : boolean

true if the application is configured, false otherwise.

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 $logger : ICanBoogie\LoggerInterface

The message logger.

public read-only $storage_for_configs : ICanBoogie\Storage\Storage
ICanBoogie 4.0.x – Check on GitHub – API documentation generated by ApiGen