_options = $options; } /** * Factory method to return a preconfigured Zend_Service_StrikeIron_* * instance. * * @param null|string $options Service options * @return object Zend_Service_StrikeIron_* instance * @throws Zend_Service_StrikeIron_Exception */ public function getService($options = array()) { $class = isset($options['class']) ? $options['class'] : 'Base'; unset($options['class']); if (strpos($class, '_') === false) { $class = "Zend_Service_StrikeIron_{$class}"; } try { if (!class_exists($class)) { #require_once 'Zend/Loader.php'; @Zend_Loader::loadClass($class); } if (!class_exists($class, false)) { throw new Exception('Class file not found'); } } catch (Exception $e) { $msg = "Service '$class' could not be loaded: " . $e->getMessage(); /** * @see Zend_Service_StrikeIron_Exception */ #require_once 'Zend/Service/StrikeIron/Exception.php'; throw new Zend_Service_StrikeIron_Exception($msg, $e->getCode(), $e); } // instantiate and return the service $service = new $class(array_merge($this->_options, $options)); return $service; } }