/** * * @param string $className * @return Miao_Form_Controller */ protected static function _getInstance($className) { $index = 'frm::' . $className; if (!Miao_Registry::isRegistered($index)) { $instance = new $className(); Miao_Registry::set($index, $instance); } return $instance; }
/** * * * Enter description here ... * * @throws Miao_Path_Exception * @return Miao_Path */ public static function getDefaultInstance() { $index = self::$_defaultindex; if (!Miao_Registry::isRegistered($index)) { throw new Miao_Path_Exception('Default instance does\'t register.'); } $result = Miao_Registry::get($index); return $result; }
protected static function _getInstance($className) { $index = 'dh:' . $className; if (Miao_Registry::isRegistered($index)) { $result = Miao_Registry::get($index); } else { $result = new $className(); Miao_Registry::set($index, $result); } return $result; }
private static function _getDefaultInstance() { $index = 'Miao_Config::default'; if (!Miao_Registry::isRegistered($index)) { $result = new self(); Miao_Registry::set($index, $result); } else { $result = Miao_Registry::get($index); } return $result; }
protected static function _getInstance($className) { $index = 'dh:jscsslist:' . $className; $result = null; if (!Miao_Registry::isRegistered($index)) { $result = new $className(); if (!$result instanceof Miao_Office_DataHelper_Url) { throw new Miao_Office_DataHelper_Url_Exception(sprintf('Invalid class %s: must be instance of Miao_Office_DataHelper_Url', $className)); } if (!$result instanceof Miao_Office_DataHelper_Url_Interface) { throw new Miao_Office_DataHelper_Url_Exception(sprintf('Invalid class %s: must be implement of Miao_Office_DataHelper_Url_Interface', $className)); } Miao_Registry::set($index, $result); } else { $result = Miao_Registry::get($index); } return $result; }
public function testRegistryArrayObject() { $registry = Miao_Registry::getInstance(); $registry['emptyArray'] = array(); $registry['null'] = null; $this->assertTrue(isset($registry['emptyArray'])); $this->assertTrue(isset($registry['null'])); $this->assertFalse(isset($registry['noIndex'])); $this->assertTrue(Miao_Registry::isRegistered('emptyArray')); $this->assertTrue(Miao_Registry::isRegistered('null')); $this->assertFalse(Miao_Registry::isRegistered('noIndex')); }