Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

57 lines (48 sloc) 1.395 kB
<?php
/**
* Setup autoloading
*/
function ZendTest_Autoloader($class)
{
$class = ltrim($class, '\\');
if (!preg_match('#^(Zend(Test)?|PHPUnit)(\\\\|_)#', $class)) {
return false;
}
// $segments = explode('\\', $class); // preg_split('#\\\\|_#', $class);//
$segments = preg_split('#[\\\\_]#', $class); // preg_split('#\\\\|_#', $class);//
$ns = array_shift($segments);
switch ($ns) {
case 'Zend':
$file = dirname(__DIR__) . '/library/Zend/';
break;
case 'ZendTest':
// temporary fix for ZendTest namespace until we can migrate files
// into ZendTest dir
$file = __DIR__ . '/Zend/';
break;
default:
$file = false;
break;
}
if ($file) {
$file .= implode('/', $segments) . '.php';
if (file_exists($file)) {
return include_once $file;
}
}
$segments = explode('_', $class);
$ns = array_shift($segments);
switch ($ns) {
case 'Zend':
$file = dirname(__DIR__) . '/library/Zend/';
break;
default:
return false;
}
$file .= implode('/', $segments) . '.php';
if (file_exists($file)) {
return include_once $file;
}
return false;
}
spl_autoload_register('ZendTest_Autoloader', true, true);
Jump to Line
Something went wrong with that request. Please try again.