Пример #1
0
XRef::registerCmdOption('', "git-rev=", '--git-rev=<rev> or --git-rev=<from>:<to> ', array("", "find errors in revision <rev>, or find errors added since rev <from> to rev <to>"));
try {
    list($options, $arguments) = XRef::getCmdOptions();
} catch (Exception $e) {
    error_log($e->getMessage());
    error_log("See 'xref-lint --help'");
    exit(1);
}
if (XRef::needHelp()) {
    $program = basename($argv[0]);
    XRef::showHelpScreen("xref-lint - tool to find problems in PHP source code", "{$program} [options] [files to check]");
    exit(1);
}
if (isset($options['init'])) {
    $xref = new XRef();
    $xref->init();
    exit(0);
}
//
// report-level:  errors, warnings or notices
// Option -r <value> is a shortcut for option -d lint.report-level=<value>
if (isset($options['report-level'])) {
    XRef::setConfigValue("lint.report-level", $options['report-level']);
}
//
// output-format: text or json
//
$outputFormat = 'text';
if (isset($options['output'])) {
    $outputFormat = $options['output'];
}