/** * Autoloads the provided class * @param string $class full class name with namespace * @return boolean true if succeeded, false otherwise */ public function autoload($class) { $class = str_replace(array('\\', '_'), File::DIRECTORY_SEPARATOR, $class) . '.php'; $file = $this->browser->getFile(Zibo::DIRECTORY_SOURCE . File::DIRECTORY_SEPARATOR . $class); if ($file) { include_once $file->getPath(); return true; } $file = $this->browser->getFile(Zibo::DIRECTORY_VENDOR . File::DIRECTORY_SEPARATOR . $class); if ($file) { include_once $file->getPath(); return true; } $directories = explode(PATH_SEPARATOR, get_include_path()); foreach ($directories as $directory) { $file = realpath($directory) . DIRECTORY_SEPARATOR . $class; if (file_exists($file)) { include_once $file; return true; } } return false; }
/** * Get a file from the Zibo file system structure * @param string $file file name relative to the Zibo file system structure * @return zibo\library\filesystem\File */ public function getFile($file) { return $this->browser->getFile($file); }