function AllowedPackages::getOperationType

Same name in other branches
  1. 8.9.x composer/Plugin/Scaffold/AllowedPackages.php \Drupal\Composer\Plugin\Scaffold\AllowedPackages::getOperationType()

Determine the type of the provided operation.

Adjusts API used for Composer 1 or Composer 2.

Parameters

\Composer\DependencyResolver\Operation\OperationInterface $operation: The operation object.

Return value

string The operation type.

1 call to AllowedPackages::getOperationType()
AllowedPackages::event in composer/Plugin/Scaffold/AllowedPackages.php
Handles package events during a 'composer require' operation.

File

composer/Plugin/Scaffold/AllowedPackages.php, line 195

Class

AllowedPackages
Determine recursively which packages have been allowed to scaffold files.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

protected function getOperationType(OperationInterface $operation) {
    // Use Composer 2 method.
    if (method_exists($operation, 'getOperationType')) {
        return $operation->getOperationType();
    }
    // Fallback to Composer 1 method.
    return $operation->getJobType();
}

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