mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-02 17:38:19 +01:00
33 lines
709 B
PHP
33 lines
709 B
PHP
<?php
|
|
|
|
/**
|
|
* @codeCoverageIgnore
|
|
*/
|
|
class PHPParser_Autoloader
|
|
{
|
|
/**
|
|
* Registers PHPParser_Autoloader as an SPL autoloader.
|
|
*/
|
|
static public function register()
|
|
{
|
|
ini_set('unserialize_callback_func', 'spl_autoload_call');
|
|
spl_autoload_register(array(__CLASS__, 'autoload'));
|
|
}
|
|
|
|
/**
|
|
* Handles autoloading of classes.
|
|
*
|
|
* @param string $class A class name.
|
|
*/
|
|
static public function autoload($class)
|
|
{
|
|
if (0 !== strpos($class, 'PHPParser')) {
|
|
return;
|
|
}
|
|
|
|
$file = dirname(dirname(__FILE__)) . '/' . strtr($class, '_', '/') . '.php';
|
|
if (is_file($file)) {
|
|
require $file;
|
|
}
|
|
}
|
|
} |