4 * This file is part of Twig.
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 @trigger_error('The Twig_Autoloader class is deprecated since version 1.21 and will be removed in 2.0. Use Composer instead.', E_USER_DEPRECATED);
15 * Autoloads Twig classes.
17 * @author Fabien Potencier <fabien@symfony.com>
19 * @deprecated since 1.21 and will be removed in 2.0. Use Composer instead. 2.0.
24 * Registers Twig_Autoloader as an SPL autoloader.
26 * @param bool $prepend whether to prepend the autoloader or not
28 public static function register($prepend = false)
30 @trigger_error('Using Twig_Autoloader is deprecated since version 1.21. Use Composer instead.', E_USER_DEPRECATED);
32 if (PHP_VERSION_ID < 50300) {
33 spl_autoload_register(array(__CLASS__, 'autoload'));
35 spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
40 * Handles autoloading of classes.
42 * @param string $class a class name
44 public static function autoload($class)
46 if (0 !== strpos($class, 'Twig')) {
50 if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) {