You are here

protected function AllowedPackages::getOperationType in Drupal 8

Same name and namespace in other branches
  1. 9 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();
}