From 15be13c081a5d129b6a1900f39fbffeb2fdf1874 Mon Sep 17 00:00:00 2001 From: za-creature Date: Sun, 30 Dec 2012 21:46:06 +0200 Subject: [PATCH] Update lib/Twig/Autoloader.php Added the ability to register the autoloader at the top of the stack, useful in some situations. --- lib/Twig/Autoloader.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Twig/Autoloader.php b/lib/Twig/Autoloader.php index 9bcec43c8..df552dd3c 100644 --- a/lib/Twig/Autoloader.php +++ b/lib/Twig/Autoloader.php @@ -19,11 +19,15 @@ class Twig_Autoloader { /** * Registers Twig_Autoloader as an SPL autoloader. + * + * @param boolean $prepend (optional) Whether to add the autoloader to + * the start of the stack. Defaults to false so the autoloader will be + * appended to the stack. */ - public static function register() + public static function register($prepend = false) { ini_set('unserialize_callback_func', 'spl_autoload_call'); - spl_autoload_register(array(new self, 'autoload')); + spl_autoload_register(array(new self, 'autoload'), true, $prepend); } /**