38 lines
809 B
PHP
Executable File
38 lines
809 B
PHP
Executable File
<?php
|
|
|
|
namespace Predis;
|
|
|
|
/*
|
|
* This file is part of the Predis package.
|
|
*
|
|
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
/**
|
|
* Autoloader
|
|
*/
|
|
function predisAutoload($className)
|
|
{
|
|
|
|
$prefix = __NAMESPACE__ . '\\';
|
|
$prefixLength = strlen($prefix);
|
|
if (0 === strpos($className, $prefix))
|
|
{
|
|
$parts = explode('\\', substr($className, $prefixLength));
|
|
$filepath = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $parts) . '.php';
|
|
|
|
if (is_file($filepath))
|
|
{
|
|
require $filepath;
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|