diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-01-07 17:33:07 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-01-07 17:33:07 -0300 |
commit | 662279e8b2cb79a03864f84fdf799f0489fdfc7b (patch) | |
tree | e7104bc31f901d16c8597cae26aa31ccb20364ab /tools/php-sqllint/src/phpsqllint/Autoloader.php | |
parent | 174d11705a13bd780dbb5c908f786fc65a6c2f9c (diff) | |
download | hercules-662279e8b2cb79a03864f84fdf799f0489fdfc7b.tar.gz hercules-662279e8b2cb79a03864f84fdf799f0489fdfc7b.tar.bz2 hercules-662279e8b2cb79a03864f84fdf799f0489fdfc7b.tar.xz hercules-662279e8b2cb79a03864f84fdf799f0489fdfc7b.zip |
Partial upgrade to v2020.01.12
Diffstat (limited to 'tools/php-sqllint/src/phpsqllint/Autoloader.php')
-rw-r--r-- | tools/php-sqllint/src/phpsqllint/Autoloader.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tools/php-sqllint/src/phpsqllint/Autoloader.php b/tools/php-sqllint/src/phpsqllint/Autoloader.php new file mode 100644 index 000000000..6811b82f1 --- /dev/null +++ b/tools/php-sqllint/src/phpsqllint/Autoloader.php @@ -0,0 +1,57 @@ +<?php +/** + * Part of php-sqllint + * + * PHP version 5 + * + * @category Tools + * @package PHP-SQLlint + * @author Christian Weiske <cweiske@cweiske.de> + * @copyright 2014 Christian Weiske + * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3 + * @link http://cweiske.de/php-sqllint.htm + */ +namespace phpsqllint; + +/** + * Class autoloader, PSR-0 compliant. + * + * @category Tools + * @package PHP-SQLlint + * @author Christian Weiske <cweiske@cweiske.de> + * @copyright 2014 Christian Weiske + * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3 + * @version Release: @package_version@ + * @link http://cweiske.de/php-sqllint.htm + */ +class Autoloader +{ + /** + * Load the given class + * + * @param string $class Class name + * + * @return void + */ + public function load($class) + { + $file = strtr($class, '_\\', '//') . '.php'; + if (stream_resolve_include_path($file)) { + include $file; + } + } + + /** + * Register this autoloader + * + * @return void + */ + public static function register() + { + set_include_path( + get_include_path() . PATH_SEPARATOR . __DIR__ . '/../' + ); + spl_autoload_register(array(new self(), 'load')); + } +} +?>
\ No newline at end of file |