From 05ea79929aa099d25b543f4a86db721f5f7e700e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 18 Nov 2019 12:11:56 +0300 Subject: Add phpsqllint for check sql queries --- tools/php-sqllint/src/phpsqllint/Autoloader.php | 57 +++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 tools/php-sqllint/src/phpsqllint/Autoloader.php (limited to 'tools/php-sqllint/src/phpsqllint/Autoloader.php') 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 @@ + + * @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 + * @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 -- cgit v1.2.3-70-g09d2