spoof
 All Data Structures Namespaces Files Functions Variables Pages
Factory Class Reference

Public Member Functions

 setType ($name, $base, $interface)
 getType ($type)
 flushCache ()

Static Public Member Functions

static get ($type, $name)

Data Fields

const OBJECT_TYPE_LANGUAGE = 'Language'
const OBJECT_TYPE_DRIVER = 'Driver'
const OBJECT_TYPE_EXECUTOR = 'Executor'

Static Protected Attributes

static $types
static $objects = array()

Detailed Description

This static class facilitates loading database objects. TODO make this class more generic, not just for DB objects


Member Function Documentation

flushCache ( )

Empties cache

static get (   $type,
  $name 
)
static

Retrieves database object, maintains internal cache of loaded objects for future use

Parameters:
string$typetype of object to retrieve
string$namename of object to retrieve
Returns:
mixed DB object requested
Exceptions:
TypeNotFoundExceptionwhen $type is invalid
ClassNotFoundExceptionwhen cannot find class definition for valid object type
NotFoundExceptionwhen object gets created but fails the check of implementing a pre-defined interface
getType (   $type)

Gets object type configuration

Parameters:
string$typetype of object
Returns:
array configuration
Exceptions:
\InvalidArgumentExceptionwhen $type is not defined
setType (   $name,
  $base,
  $interface 
)

Sets object type configuration

Parameters:
string$namename of the object type
string$basenamespace or similar prefix of object type
string$interfaceinterface the object must implement

Field Documentation

$objects = array()
staticprotected

Internal array where objects are stored and cached.

$types
staticprotected
Initial value:
array(
'Executor' => array('base' => '\lib360\db\executor\\', 'interface' => '\lib360\db\executor\IExecutor'),
'Driver' => array('base' => '\lib360\db\driver\\', 'interface' => '\lib360\db\driver\IDriver'),
'Language' => array('base'=> '\lib360\db\language\\', 'interface' => '\lib360\db\language\ILanguage')
)

Base object types allowed.

const OBJECT_TYPE_DRIVER = 'Driver'

Constant for the driver object type

const OBJECT_TYPE_EXECUTOR = 'Executor'

Constant for the executor object type

const OBJECT_TYPE_LANGUAGE = 'Language'

Constant for the language object type


The documentation for this class was generated from the following file: