Example #1
0
 /**
  * @param string $ns Namespace's description
  * @param string $path Namespace's path
  * @throws Exception
  */
 public static function registerNamespace($ns, $path)
 {
     switch (true) {
         case self::$loader instanceof \Composer\Autoload\ClassLoader:
             self::$loader->add($ns, $path);
             break;
         case self::$loader instanceof \Zend\Loader\SplAutoloader:
             self::$loader->registerPrefix($ns, $path . '/' . $ns);
             break;
             // @TODO: This hasn't been tested nor confirmed. Must test & check if OK.
         // @TODO: This hasn't been tested nor confirmed. Must test & check if OK.
         case self::$loader instanceof \Symfony\Component\ClassLoader\UniversalClassLoader:
             self::$loader->registerNamespace($ns, $path);
             break;
         default:
             throw new \Exception('No Loader detected!');
     }
 }