Menu

[r240]: / trunk / src / reporter / Reporter.php  Maximize  Restore  History

Download this file

77 lines (64 with data), 2.0 kB

 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* Abstract base class for any type of report generators
* writeError function is abstract, which will need to be implemented
* by the deriving class. Also implement start and stop functions
*
* @author Hari Kodungallur <hkodungallur@spikesource.com>
*/
abstract class Reporter {
protected $currentPhpFile;
protected $outputFile;
/**
* Constructor
* Intializes variables. Note that the output file is initialized
* to stdout if not provided
*
* @param $ofolder the output folder
* @param $ofile the output filename
*/
public function Reporter($ofolder = false, $ofile = "error.txt") {
//creating the folder if it does not already exist.
if ($ofolder!= false && !file_exists($ofolder)) {
mkdir($ofolder, 0755, true);
}
//setting the output file to default.
$this->outputFile = $ofolder.$ofile;
if (!($this->outputFile)) {
$this->outputFile = "php://output";
}
}
/**
* Any initialization before starting to write should be done here
*/
public function start() {
}
/**
* Any cleanup work before closing should be done here.
*/
public function stop() {
}
/**
* this function called everytime a new file has been started for
* checkstyle processing.
*
* @param $phpFile new file's name
*/
public function currentlyProcessing($phpFile) {
$this->currentPhpFile = $phpFile;
}
/**
* abstract function.
* For every error, this function is called once with the line where
* the error occurred and the actual error message
* It is the responsibility of the derived class to appropriately
* format it and write it into the output file
*
* @param $line line number of the error
* @param String $check the name of the check
* @param $message error message
* @param $regex the regular expression (if applicable)
* @param $level the severity level
*/
public abstract function writeError($line, $check, $message, $level = WARNING);
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.