Composer config instance.

@return \Droath\ProjectX\Config\ComposerConfig
975816
private function composer()
    {
        $composer_file = $this->composerFile();

        return file_exists($composer_file)
            ? ComposerConfig::createFromFile($composer_file)
            : new ComposerConfig();
    }
1278878
public function GetComposer() {

		$filepath = "{$this->ProjectRoot}/composer.json";

		try { $composer = new Nether\Project\Composer($filepath); }
		catch(Exception $e) {
			$this->ShowMessage($e->getMessage());
			exit(0);
		}

		return $composer;
	}
1174172
public function createRoot()
    {
        $instance = new CachedConfigCollection();

        // Override nested config to use delta collection
        $instance->setNestFactory(function ($collection) {
            return DeltaConfigCollection::createFromCollection($collection, Config::NO_DELTAS);
        });

        // Create config cache
        if ($this->cacheFactory) {
            $cache = $this->cacheFactory->create(CacheInterface::class . '.configcache', [
                'namespace' => 'configcache'
            ]);
            $instance->setCache($cache);
        }

        // Set collection creator
        $instance->setCollectionCreator(function () {
            return $this->createCore();
        });

        return $instance;
    }
1064402
public function composer()
	{
		$option = $this->arguments->getOpt('option');
		$task = $this->arguments->getOpt('task');
		$valid_tasks = array("show", "available", "install", "update", "remove", "add");
		if ($option == 'package' && in_array($task, $valid_tasks))
		{
			$newCommand = new \Hubzero\Console\Command\App\Package($this->output, $this->arguments);
			$newCommand->$task();
		}
		if ($option == 'repository' && in_array($task, $valid_tasks))
		{
			$newCommand = new \Hubzero\Console\Command\App\Repository($this->output, $this->arguments);
			$newCommand->$task();
		}
	}
874391
private static function getComposerHome(Composer $composer)
    {
        return null !== $composer->getConfig() && $composer->getConfig()->has('home')
            ? $composer->getConfig()->get('home')
            : '';
    }
765327
protected function setConfig(Composer $composer)
    {
        return new SharedPackageInstallerConfig(
            $composer->getConfig()->get('vendor-dir'),
            $composer->getConfig()->get('vendor-dir', 1),
            $composer->getPackage()->getExtra()
        );
    }
805249
private function initializeRepos()
    {
        $composer = $this->getComposer(false);

        if ($composer) {
            return array(
                $composer->getRepositoryManager()->getLocalRepository(),
                new CompositeRepository($composer->getRepositoryManager()->getRepositories())
            );
        }

        $defaultRepos = Factory::createDefaultRepositories($this->getIO());

        return array(new CompositeRepository($defaultRepos));
    }
348070
public function getComposerInstall()
    {
        if (file_exists('composer.lock')) {
            $json = json_decode(file_get_contents('composer.lock'));
            foreach ($json->packages as $package) {
                if ($package->name === 'gestionlan/framework') {
                    return $package;
                }
            }
        }

        return false;
    }
84409
public function build()
    {
        $externalVendorDirectoryOverride = false;

        //
        // External Composer Filename
        //

        if ($this->hasInternalRepository) {
            $externalComposerFilename = $this->composerFilename ?: Factory::getComposerFile();
        } else {
            $externalComposerFilename = Factory::getComposerFile();
        }

        $pristineExternalComposerFilename = $externalComposerFilename;

        if (0 !== strpos($externalComposerFilename, '/') && 1 !== strpos($externalComposerFilename, ':')) {
            $externalComposerFilename = $this->externalRootDirectory.'/'.$externalComposerFilename;
        }


        //
        // External Composer Config
        //

        $externalComposerConfig = Factory::createConfig();

        $configJsonFile = new JsonFile($externalComposerFilename);

        if ($configJsonFile->exists()) {
            try {
                $configJsonFile->validateSchema(JsonFile::LAX_SCHEMA);
                $localConfig = $configJsonFile->read();
                if (isset($localConfig['config']['vendor-dir'])) {
                    $externalVendorDirectoryOverride = true;
                }
                $externalComposerConfig->merge($localConfig);
            } catch (ParsingException $e) {
                $this->error = $e;
            }
        } else {
            if ($pristineExternalComposerFilename === 'composer.json') {
                $message = 'Composer could not find a composer.json file in '.realpath($this->externalRootDirectory);
            } else {
                $message = 'Composer could not find the config file: '.$externalComposerFilename;
            }
            $instructions = 'To initialize a project, please create a '.
                $pristineExternalComposerFilename.
                ' file as described in the http://getcomposer.org/ "Getting Started" section';

            $this->error = new \InvalidArgumentException($message.PHP_EOL.$instructions);
        }

        //
        // External Vendor Directory
        //

        if ($this->hasInternalRepository) {
            $externalVendorDirectory = ($externalVendorDirectoryOverride || ! $this->vendorDirectory)
                ? $externalComposerConfig->get('vendor-dir')
                : $this->vendorDirectory;
        } else {
            $externalVendorDirectory = $externalComposerConfig->get('vendor-dir');
        }

        if (0 !== strpos($externalVendorDirectory, '/') && 1 !== strpos($externalVendorDirectory, ':')) {
            $externalVendorDirectory = $this->externalRootDirectory.'/'.$externalVendorDirectory;
        }


        //
        // External Repository
        //

        $externalRepository = new InstalledFilesystemRepository(
            new JsonFile($externalVendorDirectory.'/composer/installed.json')
        );


        //
        // Internal Repository
        //

        $internalRepository = new CompositeRepository(array());

        if ($this->hasInternalRepository) {
            $internalInstalledRepository = new InstalledFilesystemRepository(
                new JsonFile(
                    $this->internalVendorDirectory.'/composer/installed.json'
                )
            );

            $internalRepository->addRepository($internalInstalledRepository);
        }

        $rootPackageFilename = $this->internalVendorDirectory.'/dflydev/embedded-composer/.root_package.json';
        if (file_exists($rootPackageFilename)) {
            $rootPackageRepository = new InstalledFilesystemRepository(
                new JsonFile($rootPackageFilename)
            );

            $internalRepository->addRepository($rootPackageRepository);
        }


        //
        // Repository
        //

        $repository = new CompositeRepository(array(
            $externalRepository,
            $internalRepository
        ));


        return new EmbeddedComposer(
            $this->classLoader,
            $this->externalRootDirectory,
            $externalRepository,
            $externalComposerFilename,
            $externalComposerConfig,
            $externalVendorDirectory,
            $externalVendorDirectoryOverride,
            $internalRepository,
            $this->internalVendorDirectory,
            $this->hasInternalRepository,
            $repository
        );
    }
184910
private static function getConfigBase(Composer $composer, $io = null)
    {
        $globalPackageConfig = self::getGlobalConfig($composer, 'composer', $io);
        $globalConfig = self::getGlobalConfig($composer, 'config', $io);
        $packageConfig = $composer->getPackage()->getConfig();
        $packageConfig = isset($packageConfig['foxy']) && \is_array($packageConfig['foxy'])
            ? $packageConfig['foxy']
            : array();

        return array_merge($globalPackageConfig, $globalConfig, $packageConfig);
    }
974619
public function getConfig()
    {
        if(!$this->_config instanceof ObjectConfig) {
            $this->_config = new ObjectConfig($this->__config);
        }

        return $this->_config;
    }
348498
protected function getComposer()
    {
        if ($autoloaders = spl_autoload_functions()) {
            foreach ($autoloaders as $autoload) {
                if (is_array($autoload)) {
                    $class = $autoload[0];
                    if ('Composer\Autoload\ClassLoader' == get_class($class)) {
                        return $class;
                    }
                }
            }
        }
    }
1016333
protected function getComposerCommand()
    {
        static $command = null;

        if (null !== $command) {
            return $command;
        }

        // Detect local composer.phar.
        $pharFile = $this->projectPath . '/composer.phar';

        if (file_exists($pharFile)) {
            return $command = '/usr/bin/env php -d allow_url_fopen=On -d detect_unicode=Off "' . $pharFile . '"';
        }

        // Detect local composer command
        $composerFile = $this->projectPath . '/composer';

        if (file_exists($composerFile)) {
            return $command = './composer';
        }

        // Detect global composer command.
        $process = new Process('hash composer');
        $process->run();
        $isSuccessful = $process->isSuccessful();

        unset($process);

        if ($isSuccessful) {
            return $command = 'composer';
        }

        return $command;
    }
1176062
private function loadComposerConfiguration() : array
    {
        $contents = file_get_contents($this->root . '/composer.json');
        $config = json_decode($contents, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new RuntimeException(json_last_error_msg());
        }

        return $config;
    }
731356
public function getConfig() {
		if ($this->_config !== null) {
			return $this->_config;
		}
		
		// Local config
		if ($this->_configLocal === null && method_exists($this, 'getLocalConfig') && $this->hasConfigsFactory()) {
			$localConfigSrc = $this->getLocalConfig();
			$configsFactory = $this->getConfigsFactory();

			if (is_array($localConfigSrc)) {
				$this->_configLocal = $configsFactory->create($localConfigSrc);
			}
			else if (is_string($localConfigSrc)) {
				$this->_configLocal = $configsFactory->createFromFile($localConfigSrc);
			}
			else {
				throw new NoConfig('Type of a local config\'s source must be an array or a string');
			}
			
			$this->_config = clone $this->_configLocal;
		}

		// Supplied config
		if ($this->_configSupplied === null && $this instanceof LocatorAwareInterface && $this->hasLocator()) {
			$locator  = $this->getLocator();
			$configId = $this->getConfigServiceId();
			
			if ($locator->has($configId)) {
				$this->_configSupplied = $locator->get($configId);
				
				if (! $this->_configSupplied instanceof ConfigInterface) {
					throw new NoConfig('Config must implement the "ConfigInterface"');
				}
			}
		}

		// Merge supplied config
		if ($this->_configSupplied !== null) {
			if ($this->_config === null) {
				$this->_config = clone $this->_configSupplied;
			} else {
				$this->_config = $this->_config->merge($this->_configSupplied);
			}
		}

		// Still no final config ?
		if ($this->_config === null) {
			throw new NoConfig('Unable to provide the config');
		}
		
		return $this->_config;
	}
420278
protected function setupComposerPackages()
    {
        $platform = $this->getPlatformInstance();

        if ($platform instanceof ComposerPackageInterface) {
            $platform->alterComposer($this->composer);
        }
        $this->saveComposer();

        return $this;
    }
14837
public static function getComposerMap() {
        $composerMap = array();
        foreach (self::getComposers() as $composer)
            $composerMap[call_user_func(array($composer, "getKind"))] = $composer;
        return $composerMap;
    }