2012-04-19 19:26:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// autoload.php generated by Composer
|
|
|
|
if (!class_exists('Composer\\Autoload\\ClassLoader', false)) {
|
2012-04-22 20:11:03 +00:00
|
|
|
require __DIR__ . '/composer' . '/ClassLoader.php';
|
2012-04-19 19:26:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return call_user_func(function() {
|
|
|
|
$loader = new \Composer\Autoload\ClassLoader();
|
2012-04-22 20:11:03 +00:00
|
|
|
$composerDir = __DIR__ . '/composer';
|
2012-04-19 19:26:01 +00:00
|
|
|
|
2012-04-22 20:11:03 +00:00
|
|
|
$map = require $composerDir . '/autoload_namespaces.php';
|
2012-04-19 19:26:01 +00:00
|
|
|
foreach ($map as $namespace => $path) {
|
|
|
|
$loader->add($namespace, $path);
|
|
|
|
}
|
|
|
|
|
2012-04-22 20:11:03 +00:00
|
|
|
$classMap = require $composerDir . '/autoload_classmap.php';
|
2012-04-19 19:26:01 +00:00
|
|
|
if ($classMap) {
|
|
|
|
$loader->addClassMap($classMap);
|
|
|
|
}
|
|
|
|
|
|
|
|
spl_autoload_register(function($class) {
|
2012-04-23 08:56:46 +00:00
|
|
|
$dir = dirname(__DIR__) . '/';
|
|
|
|
$prefixes = array('Main\\Foo', 'Main\\Bar');
|
2012-04-19 19:26:01 +00:00
|
|
|
foreach ($prefixes as $prefix) {
|
|
|
|
if (0 !== strpos($class, $prefix)) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-04-22 20:11:03 +00:00
|
|
|
$path = $dir . implode('/', array_slice(explode('\\', $class), 2)).'.php';
|
2012-04-19 19:26:01 +00:00
|
|
|
if (!stream_resolve_include_path($path)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
require_once $path;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$loader->register();
|
|
|
|
|
|
|
|
return $loader;
|
|
|
|
});
|