本文整理匯總了PHP中PHP_CodeSniffer_File::cleanUp方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHP_CodeSniffer_File::cleanUp方法的具體用法?PHP PHP_CodeSniffer_File::cleanUp怎麽用?PHP PHP_CodeSniffer_File::cleanUp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHP_CodeSniffer_File
的用法示例。
在下文中一共展示了PHP_CodeSniffer_File::cleanUp方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _processFile
/**
* Process the sniffs for a single file.
*
* Does raw processing only. No interactive support or error checking.
*
* @param string $file The file to process.
* @param string $contents The contents to parse. If NULL, the content
* is taken from the file system.
* @param array $restrictions The sniff codes to restrict the
* violations to.
*
* @return PHP_CodeSniffer_File
* @see processFile()
*/
private function _processFile($file, $contents, $restrictions)
{
if (PHP_CODESNIFFER_VERBOSITY > 0) {
$startTime = time();
echo 'Processing ' . basename($file) . ' ';
if (PHP_CODESNIFFER_VERBOSITY > 1) {
echo PHP_EOL;
}
}
$phpcsFile = new PHP_CodeSniffer_File($file, $this->_tokenListeners, $this->allowedFileExtensions, $this->ruleset, $restrictions, $this);
$phpcsFile->start($contents);
$phpcsFile->cleanUp();
if (PHP_CODESNIFFER_VERBOSITY > 0) {
$timeTaken = time() - $startTime;
if ($timeTaken === 0) {
echo 'DONE in < 1 second';
} else {
if ($timeTaken === 1) {
echo 'DONE in 1 second';
} else {
echo "DONE in {$timeTaken} seconds";
}
}
$errors = $phpcsFile->getErrorCount();
$warnings = $phpcsFile->getWarningCount();
echo " ({$errors} errors, {$warnings} warnings)" . PHP_EOL;
}
return $phpcsFile;
}