PHP Class Spot\Config

Inheritance: implements Serializable
Show file Open project: vlucas/spot Class Usage Examples

Protected Properties

Property Type Description
$_connections
$_defaultConnection
$_typeHandlers

Public Methods

Method Description
__construct ( )
addConnection ( string $name, string $dsn, array $options = [], $default = false ) : Spot_Adapter_Interface Add database connection
connection ( string $name = null ) : Spot_Adapter_Interface Get connection by name
defaultConnection ( ) : Spot_Adapter_Interface Get default connection
serialize ( ) Default serialization behavior is to not attempt to serialize stored adapter connections at all (thanks @TheSavior re: Issue #7)
typeHandler ( string $type, $class = null ) : Spot_Adapter_Interface Get type handler class by type
unserialize ( $serialized )

Method Details

__construct() public method

public __construct ( )

addConnection() public method

Add database connection
public addConnection ( string $name, string $dsn, array $options = [], $default = false ) : Spot_Adapter_Interface
$name string Unique name for the connection
$dsn string DSN string for this connection
$options array Array of key => value options for adapter
return Spot_Adapter_Interface Spot adapter instance

connection() public method

Get connection by name
public connection ( string $name = null ) : Spot_Adapter_Interface
$name string Unique name of the connection to be returned
return Spot_Adapter_Interface Spot adapter instance

defaultConnection() public method

Get default connection
public defaultConnection ( ) : Spot_Adapter_Interface
return Spot_Adapter_Interface Spot adapter instance

serialize() public method

Default serialization behavior is to not attempt to serialize stored adapter connections at all (thanks @TheSavior re: Issue #7)
public serialize ( )

typeHandler() public static method

Get type handler class by type
public static typeHandler ( string $type, $class = null ) : Spot_Adapter_Interface
$type string Field type (i.e. 'string' or 'int', etc.)
return Spot_Adapter_Interface Spot adapter instance

unserialize() public method

public unserialize ( $serialized )

Property Details

$_connections protected property

protected $_connections

$_defaultConnection protected property

protected $_defaultConnection

$_typeHandlers protected static property

protected static $_typeHandlers