/** * Registers the Twig autoloader after first ensuring that Twig_Autoloader * is a valid class, which it should be assuming the Twig package has been * installed into classes/Twig. If this is not true, a * BadMethodCallException is thrown. */ private static function _registerTwigAutoloader() { if (self::$_registeredTwigAutoloader) { return; } if (!class_exists('Twig_Autoloader')) { throw new BadMethodCallException('The Twig_Autoloader class does not exist.'); } Twig_Autoloader::register(); self::$_registeredTwigAutoloader = true; }