/**
  * Register sfSimpleAutoload in spl autoloader.
  *
  * @return void
  */
 public static function register()
 {
     if (self::$registered) {
         return;
     }
     ini_set('unserialize_callback_func', 'spl_autoload_call');
     if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) {
         throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance())));
     }
     if (self::getInstance()->cacheFile) {
         register_shutdown_function(array(self::getInstance(), 'saveCache'));
     }
     self::$registered = true;
 }
示例#2
0
 /**
  * Unregister sfSimpleAutoload from spl autoloader.
  *
  * @return void
  */
 public static function unregister()
 {
     spl_autoload_unregister(array(self::getInstance(), 'autoload'));
     self::$registered = false;
 }