Class Support_Resources

Description

Factory class for accessing system and application-wide resources

Located in /support/lib/Support/Resources.php (line 29)


	
			
Variable Summary
 static mixed $instance
 mixed $providers
Method Summary
 static object cache ([string $provider = null])
 static array config_data ([string $provider = null])
 static array db_connection ([boolean $writer = true], [boolean $unique = false], [string $provider = null])
 static void instance ()
 static object logger (string $name, [string $provider = null])
 static void register_cache (Support_Resources_CacheProvider $cache, string $providerName, [boolean $asDefault = false])
 static void register_config_data (Support_Resources_ConfigProvider $cfg,  $providerName, [boolean $asDefault = false], string $name)
 static void register_db_connection (Support_Resources_ConfigProvider $db,  $providerName, [boolean $asDefault = false], string $name)
 static void register_logger (Support_Resources_LoggerProvider $logger,  $providerName, [boolean $asDefault = false], string $name)
 static void register_template_engine (Support_Resources_TemplateProvider $tpl,  $providerName, [boolean $asDefault = false], string $name)
 static void set_default_cache ( $providerName, string $name)
 static void set_default_config_data ( $providerName, string $name)
 static void set_default_db_connection ( $providerName, string $name)
 static void set_default_logger ( $providerName, string $name)
 static void set_default_template_engine ( $providerName, string $name)
 static object template_engine ([string $provider = null])
 Support_Resources __construct ()
 void get_resource ()
 void register_provider (string $resource, string $provider, string $interface, object $implementor, boolean $asDefault)
 void set_default_provider (string $resource, string $provider)
Variables
static mixed $instance (line 30)
  • access: protected
mixed $providers (line 32)
  • access: protected
Methods
static cache (line 105)

Get a cache store

  • access: public
object cache ([string $provider = null])
  • string $provider: The name of the registered provider to return the instance from (uses the default provider if not specified)
static config_data (line 81)

Get the array of application configuration data

  • access: public
array config_data ([string $provider = null])
  • string $provider: The name of the registered provider to return the instance from (uses the default provider if not specified)
static db_connection (line 94)

Get a database connection

  • access: public
array db_connection ([boolean $writer = true], [boolean $unique = false], [string $provider = null])
  • boolean $writer: True if the connection must be writable (default is true)
  • boolean $unique: True if the connection must be unshared (default is false)
  • string $provider: The name of the registered provider to return the instance from (uses the default provider if not specified)
static instance (line 229)

Returns the shared instance. Used only internally.

  • access: protected
void instance ()
static logger (line 70)

Get a logger instance

  • access: public
object logger (string $name, [string $provider = null])
  • string $name: The name of the object to retrieve a logger for (typically the class name)
  • string $provider: The name of the registered provider to return the instance from (uses the default provider if not specified)
static register_cache (line 169)

Register a cache provider

  • access: public
void register_cache (Support_Resources_CacheProvider $cache, string $providerName, [boolean $asDefault = false])
  • Support_Resources_CacheProvider $cache: The provider instance
  • string $providerName: The provider name to register as
  • boolean $asDefault: Whether to make this provider the new default or not (default is false)
static register_config_data (line 143)

Register a config data provider

  • access: public
void register_config_data (Support_Resources_ConfigProvider $cfg,  $providerName, [boolean $asDefault = false], string $name)
  • Support_Resources_ConfigProvider $cfg: The provider instance
  • string $name: The provider name to register as
  • boolean $asDefault: Whether to make this provider the new default or not (default is false)
  • $providerName
static register_db_connection (line 156)

Register a db connection provider

  • access: public
void register_db_connection (Support_Resources_ConfigProvider $db,  $providerName, [boolean $asDefault = false], string $name)
  • Support_Resources_ConfigProvider $db: The provider instance
  • string $name: The provider name to register as
  • boolean $asDefault: Whether to make this provider the new default or not (default is false)
  • $providerName
static register_logger (line 130)

Register a logger provider

  • access: public
void register_logger (Support_Resources_LoggerProvider $logger,  $providerName, [boolean $asDefault = false], string $name)
  • Support_Resources_LoggerProvider $logger: The provider instance
  • string $name: The provider name to register as
  • boolean $asDefault: Whether to make this provider the new default or not (default is false)
  • $providerName
static register_template_engine (line 117)

Register a template engine provider

  • access: public
void register_template_engine (Support_Resources_TemplateProvider $tpl,  $providerName, [boolean $asDefault = false], string $name)
  • Support_Resources_TemplateProvider $tpl: The provider instance
  • string $name: The provider name to register as
  • boolean $asDefault: Whether to make this provider the new default or not (default is false)
  • $providerName
static set_default_cache (line 221)

Set the default cache provider

  • access: public
void set_default_cache ( $providerName, string $name)
  • string $name: The name of the provider to set as the default
  • $providerName
static set_default_config_data (line 201)

Set the default config data provider

  • access: public
void set_default_config_data ( $providerName, string $name)
  • string $name: The name of the provider to set as the default
  • $providerName
static set_default_db_connection (line 211)

Set the default db connection provider

  • access: public
void set_default_db_connection ( $providerName, string $name)
  • string $name: The name of the provider to set as the default
  • $providerName
static set_default_logger (line 191)

Set the default logger provider

  • access: public
void set_default_logger ( $providerName, string $name)
  • string $name: The name of the provider to set as the default
  • $providerName
static set_default_template_engine (line 181)

Set the default template engine provider

  • access: public
void set_default_template_engine ( $providerName, string $name)
  • string $name: The name of the provider to set as the default
  • $providerName
static template_engine (line 58)

Get an instance of the template engine

  • access: public
object template_engine ([string $provider = null])
  • string $provider: The name of the registered provider to return the instance from (uses the default provider if not specified)
Constructor __construct (line 37)

Constructor -- Direct instantiation is not allowed

  • access: protected
Support_Resources __construct ()
get_resource (line 238)

Generic implementation of getting a resource from a provider

  • access: protected
void get_resource ()
register_provider (line 270)

Generic implementation of registering a resource provider

  • access: protected
void register_provider (string $resource, string $provider, string $interface, object $implementor, boolean $asDefault)
  • string $resource: The name of the resource
  • string $provider: The name of this provider
  • string $interface: The name of the interface the implementor must implement
  • object $implementor: The implementor/provider instance
  • boolean $asDefault: Whether or not to register this provider as the default
set_default_provider (line 288)

Generic implementation of setting a default resource provider

  • access: protected
void set_default_provider (string $resource, string $provider)
  • string $resource: The name of the resource
  • string $provider: The name of the provider to set as the default

Documentation generated on Wed, 25 Apr 2012 09:46:45 -0700 by phpDocumentor 1.4.3