/** * The autoloader for the test-cases * * @param string $item the item to load * @return boolean whether the file has been loaded */ function PC_UnitTest_autoloader($item) { if (FWS_String::starts_with($item, 'PC_Tests_')) { $item = FWS_String::substr($item, FWS_String::strlen('PC_Tests_')); $path = 'tests/' . FWS_String::strtolower($item) . '.php'; if (is_file($path)) { include $path; return true; } } return false; }
/** * The autoloader for the todolist src-files * * @param string $item the item to load * @return boolean wether the file has been loaded */ function TDL_autoloader($item) { if (FWS_String::starts_with($item, 'TDL_')) { $item = FWS_String::substr($item, 4); $item = str_replace('_', '/', $item); $item = FWS_String::strtolower($item); $item .= '.php'; $path = FWS_Path::server_app() . 'src/' . $item; if (is_file($path)) { include $path; return true; } } return false; }
/** * The autoloader for the phpcheck src-files * * @param string $item the item to load * @return boolean whether the file has been loaded */ function PC_autoloader($item) { if (FWS_String::starts_with($item, 'PC_')) { $nitem = substr($item, 3); $parts = explode('_', $nitem); if (!FWS_String::starts_with($item, 'PC_Module_')) { array_unshift($parts, 'src'); } $nitem = implode('/', $parts); $nitem = str_replace('_', '/', $nitem); $nitem = strtolower($nitem); $nitem .= '.php'; $path = FWS_Path::server_app() . $nitem; if (is_file($path)) { include $path; return true; } } return false; }
/** * Parses the given version information * * @param string $name the version name * @return array an array with the component name and the version number */ private function get_version($name) { if (FWS_String::starts_with($name, 'PHP ')) { return explode(' ', $name); } list($name1, $name2, $version) = explode(' ', $name); return array($name1 . ' ' . $name2, $version); }