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

Breadcrumb

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

function PhpFileCleaner::skipHeredoc

1 call to PhpFileCleaner::skipHeredoc()
PhpFileCleaner::clean in vendor/composer/class-map-generator/src/PhpFileCleaner.php

File

vendor/composer/class-map-generator/src/PhpFileCleaner.php, line 195

Class

PhpFileCleaner
@author Jordi Boggiano <j.boggiano@seld.be> @internal

Namespace

Composer\ClassMapGenerator

Code

private function skipHeredoc(string $delimiter) : void {
    $firstDelimiterChar = $delimiter[0];
    $delimiterLength = \strlen($delimiter);
    $delimiterPattern = '{' . preg_quote($delimiter) . '(?![a-zA-Z0-9_\\x80-\\xff])}A';
    while ($this->index < $this->len) {
        // check if we find the delimiter after some spaces/tabs
        switch ($this->contents[$this->index]) {
            case "\t":
            case " ":
                $this->index += 1;
                continue 2;
            case $firstDelimiterChar:
                if (\substr($this->contents, $this->index, $delimiterLength) === $delimiter && $this->match($delimiterPattern)) {
                    $this->index += $delimiterLength;
                    return;
                }
                break;
        }
        // skip the rest of the line
        while ($this->index < $this->len) {
            $this->skipToNewline();
            // skip newlines
            while ($this->index < $this->len && ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n")) {
                $this->index += 1;
            }
            break;
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal