Пример #1
0
 /**
  * Get an instance of a class based on a class identifier
  *
  * @param ObjectIdentifier $identifier
  * @param bool              $fallback   Use fallbacks when locating the class. Default is TRUE.
  * @return  string  Return the identifier class or FALSE on failure.
  */
 protected function _locate(ObjectIdentifier $identifier, $fallback = true)
 {
     $class = $this->__registry->getClass($identifier);
     //If the class is FALSE we have tried to locate it already, do not locate it again.
     if (empty($class) && $class !== false) {
         $class = $this->_locators[$identifier->getType()]->locate($identifier, $fallback);
         //If we are falling back set the class in the registry
         if ($fallback) {
             if (!$this->__registry->get($identifier) instanceof ObjectInterface) {
                 $this->__registry->setClass($identifier, $class);
             }
         }
     }
     return $class;
 }