| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of Raven. |
| 5 |
* |
| 6 |
* (c) Sentry Team |
| 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 |
/** |
| 13 |
* Autoloads Raven classes. |
| 14 |
* |
| 15 |
* @package raven |
| 16 |
*/ |
| 17 |
class Lasso_Raven_Autoloader |
| 18 |
{ |
| 19 |
/** |
| 20 |
* Registers Raven_Autoloader as an SPL autoloader. |
| 21 |
*/ |
| 22 |
public static function register() |
| 23 |
{ |
| 24 |
spl_autoload_register(array('Lasso_Raven_Autoloader', 'autoload')); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Handles autoloading of classes. |
| 29 |
* |
| 30 |
* @param string $class A class name. |
| 31 |
*/ |
| 32 |
public static function autoload($class) |
| 33 |
{ |
| 34 |
if (substr($class, 0, 6) !== 'Raven_') { |
| 35 |
return; |
| 36 |
} |
| 37 |
|
| 38 |
$file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php'; |
| 39 |
if (is_file($file)) { |
| 40 |
/** @noinspection PhpIncludeInspection */ |
| 41 |
require $file; |
| 42 |
} |
| 43 |
} |
| 44 |
} |
| 45 |
|