ZenMagick 0.9.10


org.zenmagick.core\ZMRuntime
core\ZMRuntime.php at line 32

Class ZMRuntime

ZMObject
└─ZMRuntime

public class ZMRuntime
extends ZMObject

Central place for runtime stuff.

This is kind of the application context.

Author:
DerManoMann

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
static string

getApplicationPath()

Get the full application path (if set).

static ZMApplicationContext

getContext()

Get the application context.

static ZMDatabase

getDatabase(mixed conf)

Get the database (provider).

static array

getDatabases()

Get a list of all used databases.

static long

getExecutionTime(string time)

Get the currently elapsed page execution time.

static string

getInstallationPath()

Get the full ZenMagick installation path.

static string

getPluginBasePath()

Return the plugin base directory.

static void

yamlLoad(string yaml, array defaults, boolean override)

Load mappings from a YAML style string.

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Method Detail

core\ZMRuntime.php at line 124

getApplicationPath

public static string getApplicationPath()

Get the full application path (if set).

Returns:
The application base folder or null.

core\ZMRuntime.php at line 42

getContext

public static ZMApplicationContext getContext()

Get the application context.

Returns:
The context.

core\ZMRuntime.php at line 83

getDatabase

public static ZMDatabase getDatabase(mixed conf)

Get the database (provider).

ZMDatabase instances are cached, based on the given $conf data.

Supported keys for $conf are:

driver
The database driver/type; default is mysql.
host
The database host; default is DB_SERVER.
port
The database port; optional, no default.
username
The database username; default is DB_SERVER_USERNAME.
password
The database password; default is DB_SERVER_PASSWORD.
database
The database name; default is DB_DATABASE.
provider
The requested implementation class; if omitted, this defaults to ZMSettings::get('zenmagick.core.database.provider').
initQuery
An optional init query to execute; useful to set the character encoding, etc.; default is null.

If the given parameter $conf is a string, the method will lookup database settings using a settings key build like: zenmagick.core.database.connections.[$conf].

Parameters:
conf - Optional configuration; either an array with any of the supported keys, or a string; default is default.
Returns:
A ZMDatabase implementation.

core\ZMRuntime.php at line 106

getDatabases

public static array getDatabases()

Get a list of all used databases.

Returns:
List of ZMDatabase instances.

core\ZMRuntime.php at line 149

getExecutionTime

public static long getExecutionTime(string time)

Get the currently elapsed page execution time.

Parameters:
time - Optional execution timestamp to be used instead of the current time.
Returns:
The execution time in milliseconds.

core\ZMRuntime.php at line 115

getInstallationPath

public static string getInstallationPath()

Get the full ZenMagick installation path.

Returns:
The ZenMagick installation folder.

core\ZMRuntime.php at line 136

getPluginBasePath

public static string getPluginBasePath()

Return the plugin base directory.

May be configured via the setting . Default is ../lib/plugins.

Returns:
The base directory for plugins.
Todo:
make this a list to allow general and app plugins

core\ZMRuntime.php at line 164

yamlLoad

public static void yamlLoad(string yaml, array defaults, boolean override)

Load mappings from a YAML style string.

Parameters:
yaml - The yaml style mappings.
defaults - Optional defaults for merging; default is an empty array.
override - Optional flag to control whether to override existing mappings or to merge; default is true to override.

ZenMagick 0.9.10