Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NoopInstaller.php

class NoopInstaller

Does not install anything but marks packages installed in the repo

Useful for dry runs

@author Jordi Boggiano <j.boggiano@seld.be>

Hierarchy

  • class \Composer\Installer\NoopInstaller implements \Composer\Installer\InstallerInterface

Expanded class hierarchy of NoopInstaller

File

vendor/composer/composer/src/Composer/Installer/NoopInstaller.php, line 25

Namespace

Composer\Installer
View source
class NoopInstaller implements InstallerInterface {
    
    /**
     * @inheritDoc
     */
    public function supports(string $packageType) {
        return true;
    }
    
    /**
     * @inheritDoc
     */
    public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package) {
        return $repo->hasPackage($package);
    }
    
    /**
     * @inheritDoc
     */
    public function download(PackageInterface $package, ?PackageInterface $prevPackage = null) {
        return \React\Promise\resolve(null);
    }
    
    /**
     * @inheritDoc
     */
    public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null) {
        return \React\Promise\resolve(null);
    }
    
    /**
     * @inheritDoc
     */
    public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null) {
        return \React\Promise\resolve(null);
    }
    
    /**
     * @inheritDoc
     */
    public function install(InstalledRepositoryInterface $repo, PackageInterface $package) {
        if (!$repo->hasPackage($package)) {
            $repo->addPackage(clone $package);
        }
        return \React\Promise\resolve(null);
    }
    
    /**
     * @inheritDoc
     */
    public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target) {
        if (!$repo->hasPackage($initial)) {
            throw new \InvalidArgumentException('Package is not installed: ' . $initial);
        }
        $repo->removePackage($initial);
        if (!$repo->hasPackage($target)) {
            $repo->addPackage(clone $target);
        }
        return \React\Promise\resolve(null);
    }
    
    /**
     * @inheritDoc
     */
    public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package) {
        if (!$repo->hasPackage($package)) {
            throw new \InvalidArgumentException('Package is not installed: ' . $package);
        }
        $repo->removePackage($package);
        return \React\Promise\resolve(null);
    }
    
    /**
     * @inheritDoc
     */
    public function getInstallPath(PackageInterface $package) {
        $targetDir = $package->getTargetDir();
        return $package->getPrettyName() . ($targetDir ? '/' . $targetDir : '');
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
NoopInstaller::cleanup public function @inheritDoc Overrides InstallerInterface::cleanup
NoopInstaller::download public function @inheritDoc Overrides InstallerInterface::download
NoopInstaller::getInstallPath public function @inheritDoc Overrides InstallerInterface::getInstallPath
NoopInstaller::install public function @inheritDoc Overrides InstallerInterface::install
NoopInstaller::isInstalled public function @inheritDoc Overrides InstallerInterface::isInstalled
NoopInstaller::prepare public function @inheritDoc Overrides InstallerInterface::prepare
NoopInstaller::supports public function @inheritDoc Overrides InstallerInterface::supports
NoopInstaller::uninstall public function @inheritDoc Overrides InstallerInterface::uninstall
NoopInstaller::update public function @inheritDoc Overrides InstallerInterface::update

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal