function ProcessFactory::isComposerCommand

Determines if a command is running Composer.

Parameters

string[] $command: The command parts.

Return value

bool TRUE if the command is running Composer, FALSE otherwise.

1 call to ProcessFactory::isComposerCommand()
ProcessFactory::create in core/modules/package_manager/src/ProcessFactory.php

File

core/modules/package_manager/src/ProcessFactory.php, line 90

Class

ProcessFactory
Defines a process factory which sets the COMPOSER_HOME environment variable.

Namespace

Drupal\package_manager

Code

private function isComposerCommand(array $command) : bool {
    $executable = $command[0];
    $executable_parts = explode('/', $executable);
    $file = array_pop($executable_parts);
    return str_starts_with($file, 'composer');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.