getComposer example

EOT
            );

  }

  /** * {@inheritdoc} */
  protected function execute(InputInterface $input, OutputInterface $output): int {
    $handler = new Handler($this->getComposer()$this->getIO());
    $handler->scaffold();
    return 0;
  }

}

    public function validateRequirements(PluginEntity $plugin, Context $context, string $method): void
    {
        if ($plugin->getManagedByComposer()) {
            // Composer does the requirements checking if the plugin is managed by composer             // no need to do it manually
            return;
        }

        $this->shopwareProjectComposer = $this->getComposer($this->projectDir);
        $exceptionStack = new RequirementExceptionStack();

        $pluginDependencies = $this->getPluginDependencies($plugin);

        $pluginDependencies = $this->validateComposerPackages($pluginDependencies$exceptionStack);
        $pluginDependencies = $this->validateInstalledPlugins($context$plugin$pluginDependencies$exceptionStack);
        $pluginDependencies = $this->validateShippedDependencies($plugin$pluginDependencies$exceptionStack);

        $this->addRemainingRequirementsAsException($pluginDependencies['require']$exceptionStack);

        $exceptionStack->tryToThrow($method);
    }

class Composer {

  /** * Add vendor classes to Composer's static classmap. * * @param \Composer\Script\Event $event * The event. */
  public static function preAutoloadDump(Event $event) {
    // Get the configured vendor directory.     $vendor_dir = $event->getComposer()->getConfig()->get('vendor-dir');

    // We need the root package so we can add our classmaps to its loader.     $package = $event->getComposer()->getPackage();
    // We need the local repository so that we can query and see if it's likely     // that our files are present there.     $repository = $event->getComposer()->getRepositoryManager()->getLocalRepository();
    // This is, essentially, a null constraint. We only care whether the package     // is present in the vendor directory yet, but findPackage() requires it.     $constraint = new Constraint('>', '');
    // It's possible that there is no classmap specified in a custom project     // composer.json file. We need one so we can optimize lookup for some of our

  public function runScaffold($cwd) {
    chdir($cwd);
    $handler = new Handler($this->getComposer()$this->io());
    $handler->scaffold();
    return $this->getOutput();
  }

  /** * Runs a `composer` command. * * @param string $cmd * The Composer command to execute (escaped as required) * @param string $cwd * The current working directory to run the command from. * * @return string * Standard output and standard error from the command. */
Home | Imprint | This part of the site doesn't use cookies.