Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Tokenizer.php

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

Tokenizer

Namespace

PHP_CodeSniffer\Tokenizers

Code

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;
}
RSS feed
Powered by Drupal