Exemple #1
0
}
define("PHPCHECKSTYLE_HOME_DIR", dirname(__FILE__));
// require_once PHPCHECKSTYLE_HOME_DIR."/src/PHPCheckstyle.php";
require_once "vendor/autoload.php";
// check for valid format and set the output file name
// right now the output file name is not configurable, only
// the output directory is configurable (from command line)
$knownFormats = array('html', 'html_console', 'console', 'text', 'xml', 'xml_console', 'array');
$formats = explode(',', $options['format']);
$unknownFormats = array_diff($formats, $knownFormats);
if (!empty($unknownFormats)) {
    echo sprintf("\nUnknown format %s.\n\n", implode(', ', $unknownFormats));
    usage();
}
// check that source directory is specified and is valid
if (!$options['src']) {
    echo "\nPlease specify a source directory/file using --src option.\n\n";
    usage();
}
if (!empty($options['linecount'])) {
    $lineCountFile = "ncss.xml";
}
$style = new PHPCheckstyle\PHPCheckstyle($formats, $options['outdir'], $options['config'], $lineCountFile, $options['debug'], $options['progress']);
if (file_exists(__DIR__ . '/src/PHPCheckstyle/Lang/' . $options['lang'] . '.ini')) {
    $style->setLang($options['lang']);
}
$style->processFiles($options['src'], $options['exclude']);
if (!$options['quiet']) {
    echo "\nReporting Completed.\n";
}
exit(0);