Composer.php in Drupal 8
File
composer/Composer.php
View source
<?php
namespace Drupal\Composer;
use Composer\Composer as ComposerApp;
use Composer\Script\Event;
use Composer\Semver\Comparator;
use Drupal\Composer\Generator\PackageGenerator;
class Composer {
public static function generateMetapackages(Event $event) {
$generator = new PackageGenerator();
$generator
->generate($event
->getIO(), getcwd());
}
public static function ensureComposerVersion() {
$composerVersion = method_exists(ComposerApp::class, 'getVersion') ? ComposerApp::getVersion() : ComposerApp::VERSION;
if (Comparator::lessThan($composerVersion, '1.9.0')) {
throw new \RuntimeException("Drupal core development requires Composer 1.9.0, but Composer {$composerVersion} is installed. Please run 'composer self-update'.");
}
}
public static function drupalVersionBranch() {
return preg_replace('#\\.[0-9]+-dev#', '.x-dev', \Drupal::VERSION);
}
}
Classes
Name |
Description |
Composer |
Provides static functions for composer script events. See also
core/lib/Drupal/Composer/Composer.php, which contains similar
scripts needed by projects that include drupal/core. Scripts that
are only needed by drupal/drupal go here. |