Overview

Packages

  • Hermes
  • Horde
    • Data
  • Kronolith
  • None

Classes

  • Hermes
  • Hermes_Ajax_Application
  • Hermes_Api
  • Hermes_Driver
  • Hermes_Driver_Sql
  • Hermes_Factory_Driver
  • Hermes_Form_Admin_AddJobType
  • Hermes_Form_Admin_DeleteJobType
  • Hermes_Form_Admin_EditClientStepOne
  • Hermes_Form_Admin_EditClientStepTwo
  • Hermes_Form_Admin_EditJobTypeStepOne
  • Hermes_Form_Admin_EditJobTypeStepTwo
  • Hermes_Form_Deliverable
  • Hermes_Form_Deliverable_ClientSelector
  • Hermes_Form_Export
  • Hermes_Form_JobType_Edit_Step1
  • Hermes_Form_Search
  • Hermes_Form_Time
  • Hermes_Form_Time_Entry
  • Hermes_LoginTasks_SystemTask_Upgrade
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Hermes_Driver:: factory
 4:  *
 5:  * @author   Michael J. Rubinsky <mrubinsk@horde.org>
 6:  * @category Horde
 7:  * @license  http://www.horde.org/licenses/gpl GPL
 8:  * @package  Hermes
 9:  */
10: class Hermes_Factory_Driver extends Horde_Core_Factory_Injector
11: {
12:     /**
13:      * @var array
14:      */
15:     private $_instances = array();
16: 
17:     /**
18:      * Return an Hermes_Driver instance.
19:      *
20:      * @return Hermes_Driver
21:      */
22:     public function create(Horde_Injector $injector)
23:     {
24:         $driver = $GLOBALS['conf']['storage']['driver'];
25:         $signature = serialize(array($driver, $GLOBALS['conf']['storage']['params']['driverconfig']));
26:         if (empty($this->_instances[$signature])) {
27:             if ($driver == 'sql' && $GLOBALS['conf']['storage']['params']['driverconfig'] == 'horde') {
28:                 $params = array('db_adapter' => $injector->getInstance('Horde_Db_Adapter'));
29:             } else {
30:                 throw new Horde_Exception('Using non-global db connection not yet supported.');
31:             }
32:             $class = 'Hermes_Driver_' . Horde_String::ucfirst($driver);
33:             $this->_instances[$signature] = new $class($params);
34:         }
35: 
36:         return $this->_instances[$signature];
37:     }
38: 
39: }
40: 
API documentation generated by ApiGen