1<?php
2
3/*
4 * This file is part of Twig.
5 *
6 * (c) 2009 Fabien Potencier
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12@trigger_error('The "Twig_Extensions_Autoloader" class is deprecated since version 1.5. Use Composer instead.', E_USER_DEPRECATED);
13
14/**
15 * Autoloads Twig Extensions classes.
16 *
17 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
18 *
19 * @deprecated since version 1.5, use Composer instead.
20 */
21class Twig_Extensions_Autoloader
22{
23    /**
24     * Registers Twig_Extensions_Autoloader as an SPL autoloader.
25     */
26    public static function register()
27    {
28        spl_autoload_register(array(new self(), 'autoload'));
29    }
30
31    /**
32     * Handles autoloading of classes.
33     *
34     * @param string $class a class name
35     *
36     * @return bool Returns true if the class has been loaded
37     */
38    public static function autoload($class)
39    {
40        if (0 !== strpos($class, 'Twig_Extensions')) {
41            return;
42        }
43
44        if (file_exists($file = __DIR__.'/../../'.str_replace('_', '/', $class).'.php')) {
45            require $file;
46        }
47    }
48}
49