예제 #1
0
 /**
  * Returns TRUE if the $index is a named value in the registry,
  * or FALSE if $index was not found in the registry.
  *
  * @param  string $index
  * @return boolean
  */
 public static function isRegistered($index)
 {
     if (self::$_registry === null) {
         return false;
     }
     return self::$_registry->offsetExists($index);
 }
예제 #2
0
 /**
  *
  * @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;
 }
예제 #3
0
파일: Path.class.php 프로젝트: theratg/miao
 /**
  *
  *
  * 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;
 }
예제 #4
0
 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;
 }
예제 #5
0
 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;
 }
예제 #6
0
파일: Url.class.php 프로젝트: theratg/miao
 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;
 }
예제 #7
0
 public function testDefaultRegistryArrayAsPropsZF4654()
 {
     $registry = Miao_Registry::getInstance();
     $registry->bar = "baz";
     $this->assertEquals('baz', Miao_Registry::get('bar'));
 }