PHP 클래스 PHP_CodeSniffer_CLI, PHP_CodeSniffer

파일 보기 프로젝트 열기: squizlabs/php_codesniffer 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$dieOnUnknownArg boolean If FALSE, arguments that are not command line options or file/directory paths will be ignored and execution will continue.
$errorSeverity boolean The minimum severity level errors must have to be displayed.
$warningSeverity boolean The minimum severity level warnings must have to be displayed.

보호된 프로퍼티들

프로퍼티 타입 설명
$values array An array of all values specified on the command line.

공개 메소드들

메소드 설명
checkRequirements ( ) : array Exits if the minimum requirements of PHP_CodSniffer are not met.
explainStandard ( string $standard ) : void Prints a report showing the sniffs contained in a standard.
getCommandLineValues ( ) : array Gets the processed command line values.
getDefaults ( ) : array Get a list of default values for all possible command line arguments.
printConfigData ( array $data ) : void Prints out the gathered config data.
printErrorReport ( PHP_CodeSniffer $phpcs, array $reports, boolean $showSources, string $reportFile, integer $reportWidth ) : integer Prints the error report for the run.
printInstalledStandards ( ) : void Prints out a list of installed coding standards.
printPHPCBFUsage ( ) : void Prints out the usage information for PHPCBF.
printPHPCSUsage ( ) : void Prints out the usage information for PHPCS.
printUsage ( ) : void Prints out the usage information for this script.
process ( array $values = [] ) : integer Runs PHP_CodeSniffer over files and directories.
processLongArgument ( string $arg, integer $pos ) : void Processes a long (--example) command line argument.
processShortArgument ( string $arg, integer $pos ) : void Processes a short (-e) command line argument.
processUnknownArgument ( string $arg, integer $pos ) : void Processes an unknown command line argument.
runphpcbf ( ) : array Run the PHPCBF script.
runphpcs ( ) : array Run the PHPCS script.
setCommandLineValues ( array $args ) : void Set the command line values.
validateStandard ( array $standards ) : array Convert the passed standards into valid standards.

비공개 메소드들

메소드 설명
_validateReportWidth ( integer $width ) : integer Set report width based on terminal width.

메소드 상세

checkRequirements() 공개 메소드

Exits if the minimum requirements of PHP_CodSniffer are not met.
public checkRequirements ( ) : array
리턴 array

explainStandard() 공개 메소드

Prints a report showing the sniffs contained in a standard.
public explainStandard ( string $standard ) : void
$standard string The standard to validate.
리턴 void

getCommandLineValues() 공개 메소드

If the values have not yet been set, the values will be sourced from the command line arguments.
public getCommandLineValues ( ) : array
리턴 array

getDefaults() 공개 메소드

Get a list of default values for all possible command line arguments.
public getDefaults ( ) : array
리턴 array

printConfigData() 공개 메소드

Prints out the gathered config data.
public printConfigData ( array $data ) : void
$data array The config data to print.
리턴 void

printErrorReport() 공개 메소드

Note that this function may actually print multiple reports as the user may have specified a number of output formats.
public printErrorReport ( PHP_CodeSniffer $phpcs, array $reports, boolean $showSources, string $reportFile, integer $reportWidth ) : integer
$phpcs PHP_CodeSniffer The PHP_CodeSniffer object containing the errors.
$reports array A list of reports to print.
$showSources boolean TRUE if report should show error sources (not used by all reports).
$reportFile string A default file to log report output to.
$reportWidth integer How wide the screen reports should be.
리턴 integer The number of error and warning messages shown.

printInstalledStandards() 공개 메소드

Prints out a list of installed coding standards.
public printInstalledStandards ( ) : void
리턴 void

printPHPCBFUsage() 공개 메소드

Prints out the usage information for PHPCBF.
public printPHPCBFUsage ( ) : void
리턴 void

printPHPCSUsage() 공개 메소드

Prints out the usage information for PHPCS.
public printPHPCSUsage ( ) : void
리턴 void

printUsage() 공개 메소드

Prints out the usage information for this script.
public printUsage ( ) : void
리턴 void

process() 공개 메소드

Runs PHP_CodeSniffer over files and directories.
또한 보기: getCommandLineValues()
public process ( array $values = [] ) : integer
$values array An array of values determined from CLI args.
리턴 integer The number of error and warning messages shown.

processLongArgument() 공개 메소드

Processes a long (--example) command line argument.
public processLongArgument ( string $arg, integer $pos ) : void
$arg string The command line argument.
$pos integer The position of the argument on the command line.
리턴 void

processShortArgument() 공개 메소드

Processes a short (-e) command line argument.
public processShortArgument ( string $arg, integer $pos ) : void
$arg string The command line argument.
$pos integer The position of the argument on the command line.
리턴 void

processUnknownArgument() 공개 메소드

Assumes all unknown arguments are files and folders to check.
public processUnknownArgument ( string $arg, integer $pos ) : void
$arg string The command line argument.
$pos integer The position of the argument on the command line.
리턴 void

runphpcbf() 공개 메소드

Run the PHPCBF script.
public runphpcbf ( ) : array
리턴 array

runphpcs() 공개 메소드

Run the PHPCS script.
public runphpcs ( ) : array
리턴 array

setCommandLineValues() 공개 메소드

Set the command line values.
public setCommandLineValues ( array $args ) : void
$args array An array of command line arguments to process.
리턴 void

validateStandard() 공개 메소드

Checks things like default values and case.
public validateStandard ( array $standards ) : array
$standards array The standards to validate.
리턴 array

프로퍼티 상세

$dieOnUnknownArg 공개적으로 프로퍼티

If FALSE, arguments that are not command line options or file/directory paths will be ignored and execution will continue.
public bool $dieOnUnknownArg
리턴 boolean

$errorSeverity 공개적으로 프로퍼티

The minimum severity level errors must have to be displayed.
public bool $errorSeverity
리턴 boolean

$values 보호되어 있는 프로퍼티

An array of all values specified on the command line.
protected array $values
리턴 array

$warningSeverity 공개적으로 프로퍼티

The minimum severity level warnings must have to be displayed.
public bool $warningSeverity
리턴 boolean