Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
DSNPool Class Reference

Public Member Functions

 __construct (Array $dsn_arr)
 
 registerFailureDSN ($index=NULL)
 
 getDSNFromIndex ($index=-1)
 
 getDSN ()
 

Detailed Description

DSNPool.

A DSNPool object stores a list of DSN objects and provide methods for weighted-random selection, failure registration, etc.

Since
4.0.0

Definition at line 23 of file DSNPool.inc.

Constructor & Destructor Documentation

__construct ( Array  $dsn_arr)

Constructor

Parameters
array$dsn_arrThe array of DSNs public

Definition at line 49 of file DSNPool.inc.

Member Function Documentation

getDSN ( )

Get a weighted random DSN array from the DSN pool

Returns
NULL|array Return a weighted random DSN array if there is still an active (non-failure) DSN object; otherwise, return NULL public

Definition at line 116 of file DSNPool.inc.

getDSNFromIndex (   $index = -1)

Get DSN array from a DSN object specified by the index.

Parameters
int$indexThe index to get the DSN from
Returns
NULL|array Return NULL if the index is -1 or invalid; otherwise, return the DSN array of the indexed DSN object public

Definition at line 89 of file DSNPool.inc.

registerFailureDSN (   $index = NULL)

Register a DSN object as failure so that it will not be selected by the random selection. If no index is passed in, the current selected index will be used.

Parameters
int$indexThe index of the DSN object to register as failure
Returns
void public

Definition at line 67 of file DSNPool.inc.


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