public function getLoader()
{
if (null === $this->loader) {
if (strpos('@PHP-BIN@', '@PHP-BIN') === 0) {
$base = dirname(__FILE__) . '/';
set_include_path($base . PATH_SEPARATOR . get_include_path());
} else {
$base = '@PEAR-DIR@/Phrozn/';
}
//Autoload candidates.
$dirs = array($base . '..', getcwd());
foreach ($dirs as $dir) {
$file = $dir . '/vendor/autoload.php';
if (file_exists($file)) {
$this->loader = (include $file);
break;
}
}
if (null === $this->loader) {
throw new \RuntimeException("Unable to locate autoloader.");
}
}
return $this->loader;
}