PHP_CodeSniffer_Reports_Notifysend
in package
implements
PHP_CodeSniffer_Report
Notify-send report for PHP_CodeSniffer.
Supported configuration parameters:
- notifysend_path - Full path to notify-send cli command
- notifysend_timeout - Timeout in milliseconds
- notifysend_showok - Show "ok, all fine" messages (0/1)
Tags
Interfaces, Classes and Traits
- PHP_CodeSniffer_Report
- Represents a PHP_CodeSniffer report.
Table of Contents
- $path : string
- Path to notify-send command.
- $showOk : bool
- Show "ok, all fine" messages.
- $timeout : int
- Notification timeout in milliseconds.
- $version : string
- Version of installed notify-send executable.
- $_lastCheckedFile : string
- A record of the last file checked.
- __construct() : mixed
- Load configuration data.
- generate() : void
- Generates a summary of errors and warnings for each file processed.
- generateFileReport() : bool
- Generate a partial report for a single processed file.
- generateMessage() : string
- Generate the error message to show to the user.
- getBasicCommand() : string
- Generate and return the basic notify-send command string to execute.
- notifyAllFine() : void
- Tell the user that all is fine and no error/warning has been found.
- notifyErrors() : void
- Tell the user that errors/warnings have been found.
Properties
$path
Path to notify-send command.
protected
string
$path
= 'notify-send'
$showOk
Show "ok, all fine" messages.
protected
bool
$showOk
= rue
$timeout
Notification timeout in milliseconds.
protected
int
$timeout
= 3000
$version
Version of installed notify-send executable.
protected
string
$version
=
ull
$_lastCheckedFile
A record of the last file checked.
private
string
$_lastCheckedFile
= ''
This is used in case we only checked one file and need to print the name/path of the file. We wont have access to the checked file list after the run has been completed.
Methods
__construct()
Load configuration data.
public
__construct() : mixed
Return values
mixed —generate()
Generates a summary of errors and warnings for each file processed.
public
generate(string $cachedData, int $totalFiles, int $totalErrors, int $totalWarnings, int $totalFixable[, bool $showSources = false ][, int $width = 80 ][, bool $toScreen = true ]) : void
Parameters
- $cachedData : string
-
Any partial report data that was returned from generateFileReport during the run.
- $totalFiles : int
-
Total number of files processed during the run.
- $totalErrors : int
-
Total number of errors found during the run.
- $totalWarnings : int
-
Total number of warnings found during the run.
- $totalFixable : int
-
Total number of problems that can be fixed.
- $showSources : bool = false
-
Show sources?
- $width : int = 80
-
Maximum allowed line width.
- $toScreen : bool = true
-
Is the report being printed to screen?
Return values
void —generateFileReport()
Generate a partial report for a single processed file.
public
generateFileReport(array<string|int, mixed> $report, PHP_CodeSniffer_File $phpcsFile[, bool $showSources = false ][, int $width = 80 ]) : bool
Function should return TRUE if it printed or stored data about the file and FALSE if it ignored the file. Returning TRUE indicates that the file and its data should be counted in the grand totals.
Parameters
- $report : array<string|int, mixed>
-
Prepared report data.
- $phpcsFile : PHP_CodeSniffer_File
-
The file being reported on.
- $showSources : bool = false
-
Show sources?
- $width : int = 80
-
Maximum allowed line width.
Return values
bool —generateMessage()
Generate the error message to show to the user.
protected
generateMessage(int $totalFiles, int $totalErrors, int $totalWarnings) : string
Parameters
- $totalFiles : int
-
Total number of files processed during the run.
- $totalErrors : int
-
Total number of errors found during the run.
- $totalWarnings : int
-
Total number of warnings found during the run.
Return values
string —Error message or NULL if no error/warning found.
getBasicCommand()
Generate and return the basic notify-send command string to execute.
protected
getBasicCommand() : string
Return values
string —Shell command with common parameters.
notifyAllFine()
Tell the user that all is fine and no error/warning has been found.
protected
notifyAllFine() : void
Return values
void —notifyErrors()
Tell the user that errors/warnings have been found.
protected
notifyErrors(string $msg) : void
Parameters
- $msg : string
-
Message to display.