* @license PHP License * @package Wombat * @subpackage base */ /** * Instance creator * * Functor to encapsulate new operator * * @version 0.3.0 * @package Wombat * @subpackage base */ class WBClass_Creator_WBRequest extends WBClass_Creator { /** * keep instances of current request object * * @var array */ static protected $instances = array(); /** * return request object * * There is only a single request object per type. * * @param array $parameter * @return object */ public function instantiate($parameter = array()) { // select module if (!isset($parameter['module']) || empty($parameter['module'])) { $parameter['module'] = 'Http'; } $clazz = 'WBRequest_' . WBParam::get('wb/request/module', $parameter['module']); if (isset(self::$instances[$clazz])) { return self::$instances[$clazz]; } WBClass::load($clazz); self::$instances[$clazz] = new $clazz(); return self::$instances[$clazz]; } } ?>