Working with application

The Application instance

Application runtime schema

Application object methods for HTTP and CLI modes

string config(string $item [, string $section])

Returns the application main configuration values as they were loaded from the /application/config/tokernel.ini file

$dt = $this->app->config('date_timezone', 'APPLICATION'); $cf = $this->app->config('cache_file_extension', 'CACHING'); $se = $this->app->config('some_item');

void error(int $code, string $message [, string $file] [, int $line])

Triggers an error. Depending on your settings it will generate error messages in the log file or on screen and exit

This function is similar to the regular PHP function - trigger_error().

$this->app->error(E_USER_WARNING, 'Something went wrong!', __FILE__, __LINE__); $this->app->error(E_USER_ERROR, 'Invalid value!');

bool initialized()

Returns the application initialization status.

$s = $this->app->initialized();

The Application instance is initialized once by the framework loader at startup.

bool runned()

Returns the application running status. The framework loader, after initializing the application instance, invokes the application's run() method once. It may not be called a second time from anywhere in the application.

$rs = $this->app->runned();

The application run() method will in turn initialize the main addon. There is a difference between HTTP and CLI modes in the way they run.

array timezones([string $section])

Returns the timezones array as loaded from the /framework/config/timezones.ini file

$all_timezones = $this->app->timezones(); $America_timezones = $this->app->timezones('America');