Example #1
0
 /**
  * Unregister an AutoLoadable Object
  *
  * @param Next\Loader\AutoLoader\AutoLoadable $autoloader
  *   The AutoLoader Object to be registered
  *
  * @return Next\AutoLoader
  *   AutoLoader Instance (Fluent Interface)
  *
  * @throws Next\LoaderException
  *   Trying to unregister a non registered AutoLoadable Object
  */
 public function unregisterAutoLoader(AutoLoadable $autoloader)
 {
     if (!$this->autoloaders->contains($autoloader)) {
         require_once 'LoaderException.php';
         throw LoaderException::unknown();
     }
     $this->autoloaders->detach($autoloader);
     spl_autoload_unregister($autoloader->call());
     return $this;
 }
Example #2
0
 /**
  * XML Map File AutoLoader
  *
  * @param string $file
  *   XML Map File to work with
  *
  * @throws Next\LoaderException
  *   XML Filename was not set
  *
  * @throws Next\LoaderException
  *   XML File is not readable
  */
 public function __construct($file)
 {
     // XML File must exist
     if (!is_file($file)) {
         require_once '/../LoaderException.php';
         throw LoaderException::unfullfilledRequirements('XML File File <strong>%s</strong> doesn\'t exists', array($file));
     }
     // ... and must be readable
     if (!is_readable($file)) {
         require_once __DIR__ . '/LoaderException.php';
         throw LoaderException::unfullfilledRequirements('XML File <strong>%s</strong> is not readable', LoaderException::UNFULFILLED_REQUIREMENTS, $file);
     }
     self::$map = file_get_contents($file);
 }