独自のレポートを作成することは、実際には非常に簡単です。
CLI から実行している場合は、固有のメソッドを使用して独自のレポート クラスを実装し、それをコマンド ligne から呼び出すことができます。Xxx という名前のレポートの場合:
class PHP_CodeSniffer_Reports_Xxx implements PHP_CodeSniffer_Report
{
/**
* Prints all errors and warnings for each file processed.
*
* Errors and warnings are displayed together, grouped by file.
*
* @param array $report Prepared report.
* @param boolean $showSources Show sources?
* @param int $width Maximum allowed lne width.
* @param boolean $toScreen Is the report being printed to screen?
*
* @return string
*/
public function generate(
$report,
$showSources=false,
$width=80,
$toScreen=true
) {
...
}
}
Web サーバーから実行している場合、このPHP_CodeSniffer.getFilesErrors()
メソッドは、レポートを作成するために必要なすべてのエラーの素晴らしい配列を提供します。