-
Notifications
You must be signed in to change notification settings - Fork 31
/
runFromWeb.php
46 lines (35 loc) · 1.16 KB
/
runFromWeb.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
define("PHPCHECKSTYLE_HOME_DIR", dirname(__FILE__));
require_once "vendor/autoload.php";
// default values
$options['format'] = "array"; // default format
// Get user selection
$sourceDir = $_POST['sourceDir'];
$resultDir = $_POST['resultDir'];
$configFile = $_POST['configFile'];
$lange = $_POST['lang'];
if ($_POST['excludeFile']) {
$expFile = explode(',', $_POST['excludeFile']);
$options['exclude'] = $expFile;
} else {
$options['exclude'] = array();
}
//
$formats = explode(',', $options['format']);
$sources = explode(',', $sourceDir);
// TODO: Make this an includeable file
$configFile = array(
'indentation' => array(
"type" => "spaces",
"number" => 2
)
);
// Launch PHPCheckstyle
$style = new PHPCheckstyle\PHPCheckstyle($formats, $resultDir, $configFile, null, false, true);
if (file_exists(__DIR__ . '/src/PHPCheckstyle/Lang/' . $options['lang'] . '.ini')) {
$style->setLang($options['lang']);
}
$style->processFiles($sources, $options['exclude']);
echo "<pre>" . print_r($style->_reporter->reporters[0]->outputFile, TRUE) . "</pre>";
echo "Reporting Completed.</BR></BR>";
echo 'Display Results : <a href="' . $resultDir . '">' . $resultDir . '</a>';