コード例 #1
0
ファイル: RootDoc.class.php プロジェクト: xp-framework/doclet
 /**
  * Adds a source loader
  *
  * @param   lang.IClassLoader
  */
 public function addSourceLoader(\lang\IClassLoader $l)
 {
     $this->sourcepath[$l->hashCode()] = $l;
 }
コード例 #2
0
ファイル: ClassLoader.class.php プロジェクト: johannes85/core
 /**
  * Unregister a class loader as a delegate
  *
  * @param   lang.IClassLoader l
  * @return  bool TRUE if the delegate was unregistered
  */
 public static function removeLoader(IClassLoader $l)
 {
     $id = $l->instanceId();
     if (isset(self::$delegates[$id])) {
         unset(self::$delegates[$id]);
         if (isset(self::$modules[$id])) {
             if (Module::$INCOMPLETE !== self::$modules[$id]) {
                 Module::remove(self::$modules[$id]);
             }
             unset(self::$modules[$id]);
         }
         return true;
     }
     return false;
 }
コード例 #3
0
ファイル: XPClass.class.php プロジェクト: xp-framework/core
 /**
  * Returns the XPClass object associated with the class with the given 
  * string name. Uses the default classloader if none is specified.
  *
  * @param   string name - e.g. "Exception", "io.File" or "lang.XPClass"
  * @param   lang.IClassLoader classloader default NULL
  * @return  lang.XPClass class object
  * @throws  lang.ClassNotFoundException when there is no such class
  */
 public static function forName($name, IClassLoader $classloader = null) : self
 {
     $p = strpos($name, '\\');
     if (false === $p) {
         // No backslashes, using dotted form
         $resolved = strtr($name, '.', '\\');
     } else {
         // Name literal
         $resolved = 0 === $p ? substr($name, 1) : $name;
         $name = strtr($resolved, '\\', '.');
     }
     if (class_exists($resolved, false) || interface_exists($resolved, false) || trait_exists($resolved, false)) {
         return new self($resolved);
     } else {
         if (null === $classloader) {
             return ClassLoader::getDefault()->loadClass($name);
         } else {
             return $classloader->loadClass($name);
         }
     }
 }