bebeboutik/tools/predis/autoloadPrestashop.php

28 lines
542 B
PHP
Raw Permalink Normal View History

2017-10-25 13:53:42 +02:00
<?php
namespace Predis;
/**
* 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;
}