$Iclass = trim(readline("Name for the new interfae: "));
} else {
    $path = getcwd() . DIRECTORY_SEPARATOR . $argv[1];
    $class = $argv[2];
    $Ipath = getcwd() . DIRECTORY_SEPARATOR . $argv[3];
    $Inamespace = substr($argv[4], 0, strrpos($argv[4], "\\"));
    $Iclass = substr($argv[4], strrpos($argv[4], "\\") + 1);
    if (!is_file($path) || !is_readable($path)) {
        errorexit(2, "Can not read from class file (parameter 1).");
    }
    require_once $path;
    if (!class_exists($class)) {
        errorexit(3, "Can not find class \"{$class}\" (parameter 2).");
    }
    if (is_file($Ipath)) {
        errorexit(4, "Can not write to interface file (parameter 3). File exists.");
    }
}
$rClass = new ReflectionClass($class);
$rMethods = $rClass->getMethods();
$interfaceContent = "<?php " . PHP_EOL;
$interfaceContent .= "namespace " . $rClass->getNamespaceName() . ";" . PHP_EOL . PHP_EOL;
$interfaceContent .= "interface " . $Iclass . "{" . PHP_EOL . PHP_EOL;
foreach ($rMethods as $rMethod) {
    if ($rMethod->isPublic() && !$rMethod->isStatic()) {
        $interfaceContent .= "   public function ";
        $interfaceContent .= $rMethod->getName() . "(";
        foreach ($rMethod->getParameters() as $rParameter) {
            if ($rParameter->isArray()) {
                $interfaceContent .= "array ";
            }
示例#2
0
    if (file_exists("work/done_{$_REQUEST['id']}")) {
        // Job should be done now?
        $s = stat('work/blastoutput_' . $_REQUEST['id']);
        if ($s['size']) {
            $xmlstr = file_get_contents('work/blastoutput_' . $_REQUEST['id']);
            $xml = new SimpleXMLElement($xmlstr);
            $optionsfile = file_get_contents('work/blastoptions_' . $_REQUEST['id']);
            if (strpos($optionsfile, "query: ") != 0) {
                $formdata = unserialize(base64_decode(substr($optionsfile, strpos($optionsfile, "query: ") + 7)));
            }
        }
        if (!$xmlstr || !$xml) {
            print file_get_contents('blast_header.template.html');
            print "<span class='loading'>Sorry, something seems to have gone awry with your search\n" . " did you provide a correct fasta sequence?</span>";
            print file_get_contents('blast_footer.template.html');
            errorexit("Blast gave errors");
        }
    }
}
// Early exit functions first
// DB query track
if ($_REQUEST['op'] == 'dbs' && $_REQUEST['js'] != '' && $_REQUEST['program'] != '') {
    // Should be safe to use $_REQUEST['program'] without additional washing.
    // Return an object with the program (string) and dbs (array).
    $result = '{ "program":"' . $_REQUEST['program'] . '", "dbs": [';
    $dbs = dbs_per_prog($_REQUEST['program']);
    // Build a list of all the dbs: "dbname",
    $dbstring = "";
    foreach ($dbs as $db) {
        $dbstring = $dbstring . "\n\"{$db}\",";
    }