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

Breadcrumb

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

function InitCommand::hasVendorIgnore

Checks the local .gitignore file for the Composer vendor directory.

Tested patterns include: "/$vendor" "$vendor" "$vendor/" "/$vendor/" "/$vendor/*" "$vendor/*"

1 call to InitCommand::hasVendorIgnore()
InitCommand::execute in vendor/composer/composer/src/Composer/Command/InitCommand.php

File

vendor/composer/composer/src/Composer/Command/InitCommand.php, line 565

Class

InitCommand
@author Justin Rainbow <justin.rainbow@gmail.com> @author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Command

Code

protected function hasVendorIgnore(string $ignoreFile, string $vendor = 'vendor') : bool {
    if (!file_exists($ignoreFile)) {
        return false;
    }
    $pattern = sprintf('{^/?%s(/\\*?)?$}', preg_quote($vendor));
    $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
    foreach ($lines as $line) {
        if (Preg::isMatch($pattern, $line)) {
            return true;
        }
    }
    return false;
}

API Navigation

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