Configure an extension.

GET (:orchestra)/extensions/configure/(:name)

@param  \Orchestra\Foundation\Processors\Extension\Configure  $processor
@param  string  $vendor
@param  string|null  $package

@return mixed
182416
public function configure(Processor $processor, $vendor, $package = null)
    {
        $extension = $this->getExtension($vendor, $package);

        return $processor->configure($this, $extension);
    }
713714
public function packages($vendors)
    {
        $packages = [];

        foreach ((array) $vendors as $vendor) {
            if (strpos($vendor, '/') !== false) {
                $packages[] = $this->packagist->get($vendor);
            } else {
                foreach ($this->packagist->all(compact('vendor')) as $result) {
                    $packages[] = $this->packagist->get($result);
                }
            }
        }

        return $packages;
    }
924004
public function install($package)
    {
        if (! is_null($package)) {
            $package = '"'.$package.'"';
        }
        $process = $this->getProcess();
        $process->setCommandLine(trim($this->findComposer().' require '.$package));
        $process->run($this->output);
    }
752161
public function findPackageByName($vendor, $packageName = '')
    {
        if ($packageName === '') {
            if (strpos($vendor, '/') === false) {
                throw new Exception('Invalid package name');
            }
            list($vendor, $packageName) = explode('/', $vendor);
        }

        return $this->makeRequest("/packages/{$vendor}/{$packageName}.json");
    }
1271423
public function getForPackage($package, $key, $default = null)
    {
        if (empty($this->packagesConfiguration[$package])) {
            return $default;
        }
        return Arr::get($this->packagesConfiguration[$package], $key, $default);
    }
230528
public static function enablePackage(PackageInterface $package)
    {
        $packageRepository = Factory::makePackageRepository($package);
        $bundleFactory = Factory::makeBundleFactory();
        $kernelManipulator = Factory::makeKernelManipulator();

        $composerPackage = $packageRepository->findOneByName($package->getName());
        $bundle = $bundleFactory->make($composerPackage->namespace);

        $kernelManipulator->addBundle($bundle->fullyQualifiedClassname);
    }
1190348
def get_processor(self, entity_id, sp_config):
        
        processor_string = sp_config.get('processor', None)
        if processor_string:
            try:
                return import_string(processor_string)(entity_id)
            except Exception as e:
                logger.error("Failed to instantiate processor: {} - {}".format(processor_string, e), exc_info=True)
                raise
        return BaseProcessor(entity_id)
597975
protected function readFromSource(array $source, string $package) : ?string
    {
        // Abort if no name property
        if(!isset($source['name'])){
            return null;
        }

        // Abort if name is not the same a package name
        if($source['name'] != $package){
            return null;
        }

        // At this point it means that the package matches.
        // We check for a version property.
        if(isset($source['version'])){
            return $source['version'];
        }

        // This means that no version property existed - which
        // could mean that the source is an actual composer file.
        // Therefore, we check if there is an branch alias
        // specified. (dev-master assumed)
        if(isset($source['extra']['branch-alias']['dev-master'])){
            return $source['extra']['branch-alias']['dev-master'];
        }

        // Sadly, if reached here then there is no version available
        // nor a branch alias. Therefore, we can only return a default
        // version...
        return self::DEFAULT_VERSION;
    }
950617
protected function getExtension($vendor, $package = null)
    {
        $name = (is_null($package) ? $vendor : implode('/', [$vendor, $package]));

        return new Fluent(['name' => $name, 'uid' => $name]);
    }
880297
public function setForPackage($package, $key, $value)
    {
        $packageConfiguration = empty($this->packagesConfiguration[$package]) ? array() : $this->packagesConfiguration[$package];
        Arr::set($packageConfiguration, $key, $value);
        $this->packagesConfiguration[$package] = $packageConfiguration;
        return $this;
    }
119499
public function addRequire($vendor, $version)
    {
        if (!isset($this->require[$vendor])) {
            $this->require[$vendor] = $version;
        }

        return $this;
    }
80219
private function requireComposerPackage($package)
    {
        $composer = $this->findComposer();
        $process = new Process($composer.' require '.$package.''.$this->getDevOption(),
                       null, null, null, null);
        $this->output->writeln('<info>Running composer require '.$package.$this->getDevOption().'</info>');
        $process->run(function ($type, $line) {
            $this->output->write($line);
        });
    }
517232
public static function get(Composer $composer): ?ProjectTypeInterface
    {
        $rootDir = dirname($composer->getConfig()->getConfigSource()->getName());

        $classes = static::getClasses($composer);

        $composerProjectType = $composer->getPackage()->getExtra()['rikudou']['installer']['project-type'] ?? null;
        if ($composerProjectType && isset($classes[$composerProjectType])) {
            $class = $classes[$composerProjectType];

            return new $class;
        }

        foreach ($classes as $class) {
            /** @var ProjectTypeInterface $instance */
            $instance = new $class;
            foreach ($instance->getDirs() as $dir) {
                if (is_array($dir)) {
                    $exists = true;
                    foreach ($dir as $requiredDir) {
                        $exists = $exists && file_exists("{$rootDir}/{$requiredDir}");
                    }
                    if ($exists) {
                        return $instance;
                    }
                } else {
                    if (file_exists("{$rootDir}/{$dir}")) {
                        return $instance;
                    }
                }
            }
        }

        return null;
    }
1022259
public function getInstallPath(PackageInterface $package)
    {
        $type = $package->getType();
        if (substr($type, 0, strlen(self::NAME)) !== self::NAME) {
            throw new InvalidArgumentException(
                'Sorry the package type of this package is not yet supported.'
            );
        }

        $subPackageType = substr($type, strlen(self::NAME) + 1);

        $prettyName = $package->getPrettyName();
        if (strpos($prettyName, '/') !== false) {
            list($vendor, $name) = explode('/', $prettyName);
        } else {
            $vendor = '';
            $name = $prettyName;
        }

        $extra = $package->getExtra();
        if (!empty($extra['installer-name'])) {
            $name = $extra['installer-name'];
        }

        $availableVars = compact('name', 'vendor', 'type');

        if ($this->composer->getPackage()) {
            $extra = $this->composer->getPackage()->getExtra();
            if (!empty($extra['installer-paths'])) {
                $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor);
                if (!empty($customPath)) {
                    return $this->templatePath($customPath, $availableVars);
                }
            }
        }

        $locations = self::LOCATIONS;
        if (!isset($locations[$subPackageType])) {
            throw new InvalidArgumentException(sprintf('Sub-package type "%s" is not supported', $type));
        }

        return $this->templatePath($locations[$subPackageType], $availableVars);
    }
1075203
public static function isAsset(PackageInterface $package, array $configPackages = array())
    {
        $projectConfig = self::getProjectActivation($package, $configPackages);
        $enabled = false !== $projectConfig;

        return $enabled && (static::hasExtraActivation($package)
            || static::hasPluginDependency($package->getRequires())
            || static::hasPluginDependency($package->getDevRequires())
            || true === $projectConfig);
    }
707691
protected function getSource($package)
    {
        $namespaces = $this->config->getNamespaces();

        $source = isset($namespaces[$package]) ? $namespaces[$package] : null;

        if (is_null($source) || ! $this->files->isDirectory($source)) {
            throw new \InvalidArgumentException("Configuration not found.");
        }

        return $source;
    }
300697
private function findComposerDirectory($vendor, $file = '')
    {
        $composerDirectory = $this->normalizePath($vendor . '/composer/' . $file);

        if ($this->files->exists($composerDirectory)) {
            return $composerDirectory;
        }

        return false;
    }