function Tokenizer::isMinifiedContent
Checks the content to see if it looks minified.
Parameters
string $content The content to tokenize.:
string $eolChar The EOL char used in the content.:
Return value
boolean
2 calls to Tokenizer::isMinifiedContent()
- CSS::__construct in vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ CSS.php - Initialise the tokenizer.
- JS::__construct in vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ JS.php - Initialise the tokenizer.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ Tokenizer.php, line 117
Class
Namespace
PHP_CodeSniffer\TokenizersCode
protected function isMinifiedContent($content, $eolChar = '\\n') {
// Minified files often have a very large number of characters per line
// and cause issues when tokenizing.
$numChars = strlen($content);
$numLines = substr_count($content, $eolChar) + 1;
$average = $numChars / $numLines;
if ($average > 100) {
return true;
}
return false;
}