AllowedPackages
class AllowedPackages implements PostPackageEventListenerInterface (View source)
| internal |
Determine recursively which packages have been allowed to scaffold files.
If the root-level composer.json allows drupal/core, and drupal/core allows drupal/assets, then the later package will also implicitly be allowed.
Properties
| protected Composer | $composer | The Composer service. |
|
| protected IOInterface | $io | Composer's I/O service. |
|
| protected ManageOptions | $manageOptions | Manager of the options in the top-level composer.json's 'extra' section. |
|
| protected array | $newPackages | The list of new packages added by this Composer command. |
Methods
AllowedPackages constructor.
Gets a list of all packages that are allowed to copy scaffold files.
Handles package events during a 'composer require' operation.
Gets all packages that are allowed in the top-level composer.json.
Builds a name-to-package mapping from a list of package names.
Evaluates newly-added packages and see if they are already allowed.
Determine the type of the provided operation.
Retrieves a package from the current composer process.
Details
__construct(Composer $composer, IOInterface $io, ManageOptions $manage_options)
AllowedPackages constructor.
PackageInterface[]
getAllowedPackages()
Gets a list of all packages that are allowed to copy scaffold files.
We will implicitly allow the projects 'drupal/legacy-scaffold-assets' and 'drupal/core' to scaffold files, if they are present. Any other project must be explicitly whitelisted in the top-level composer.json file in order to be allowed to override scaffold files. Configuration for packages specified later will override configuration specified by packages listed earlier. In other words, the last listed package has the highest priority. The root package will always be returned at the end of the list.
event(PackageEvent $event)
Handles package events during a 'composer require' operation.
protected array
getTopLevelAllowedPackages()
Gets all packages that are allowed in the top-level composer.json.
We will implicitly allow the projects 'drupal/legacy-scaffold-assets' and 'drupal/core' to scaffold files, if they are present. Any other project must be explicitly whitelisted in the top-level composer.json file in order to be allowed to override scaffold files.
protected PackageInterface[]
recursiveGetAllowedPackages(array $packages_to_allow, array $allowed_packages = [])
Builds a name-to-package mapping from a list of package names.
protected PackageInterface[]
evaluateNewPackages(array $allowed_packages)
Evaluates newly-added packages and see if they are already allowed.
For now we will only emit warnings if they are not.
protected string
getOperationType(OperationInterface $operation)
Determine the type of the provided operation.
Adjusts API used for Composer 1 or Composer 2.
protected PackageInterface|null
getPackage(string $name)
Retrieves a package from the current composer process.