ZenMagick 0.9.11


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

Class ZMRuntime

ZMRuntime

public class ZMRuntime

Central place for runtime stuff.

This is kind of the application context.

Author:
DerManoMann

Method Summary
static string

getApplicationPath()

Get the full application path (if set).

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 array

getPluginBasePath()

Return the plugin base directory.

static mixed

singleton(string name, string instance, boolean force)

Get a singleton instance of the named class.

static void

yamlParse(string yaml, array defaults, boolean override)

Load mappings from a YAML style string.

Method Detail

core\ZMRuntime.php at line 132

getApplicationPath

public static string getApplicationPath()

Get the full application path (if set).

Returns:
The application base folder or null.

core\ZMRuntime.php at line 91

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.
socket
Optional unix socket name if used to talk to the database instead of IP.
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 114

getDatabases

public static array getDatabases()

Get a list of all used databases.

Returns:
List of ZMDatabase instances.

core\ZMRuntime.php at line 157

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 123

getInstallationPath

public static string getInstallationPath()

Get the full ZenMagick installation path.

Returns:
The ZenMagick installation folder.

core\ZMRuntime.php at line 143

getPluginBasePath

public static array getPluginBasePath()

Return the plugin base directory.

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

Returns:
List of base directories for plugins.

core\ZMRuntime.php at line 47

singleton

public static mixed singleton(string name, string instance, boolean force)

Get a singleton instance of the named class.

Parameters:
name - The class name.
instance - If set, register the given object, unless the name is already taken.
force - Optional flag to force replacement.
Returns:
A singleton object.

core\ZMRuntime.php at line 172

yamlParse

public static void yamlParse(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.11