/** * Register a new 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 register an already registred AutoLoadable Object */ public function registerAutoLoader(AutoLoadable $autoloader) { if ($this->autoloaders->contains($autoloader)) { require_once 'LoaderException.php'; throw LoaderException::duplicated(); } $this->autoloaders->attach($autoloader); spl_autoload_register($autoloader->call()); return $this; }