Create \Composer\Composer

@return \Composer\Composer
@throws \Exception
765409
function create()
    {
        if (!getenv('COMPOSER_HOME')) {
            putenv('COMPOSER_HOME=' . $this->directoryList->getPath(DirectoryList::COMPOSER_HOME));
        }
        return \Composer\Factory::create(
            new BufferIO(),
            $this->composerJsonFinder->findComposerJson()
        );
    }
850399
protected function updateComposerConfig()
    {
        parent::updateComposerConfig();
        $this->composerManager->updateProjectConfig(array(
            'name' => $this->composerManager->createPackageName($this->projectName),
            'license' => 'proprietary',
            'description' => null,
            'extra' => array('branch-alias' => null),
        ));

        return $this;
    }
1129008
public function createInstance()
    {
        $classname = $this->getProjectClassname();

        if (!class_exists($classname)) {
            throw new \Exception(
                sprintf('Unable to locate class %s', $classname)
            );
        }

        return new $classname();
    }
864455
protected function getComposer()
    {
        if (!$this->composer) {
            // Set composer environment variables
            putenv('COMPOSER_HOME=' . $this->app['path_resolver']->resolve('%cache%/composer'));

            // Set working directory
            chdir($this->getOptions()->baseDir());

            try {
                // Use the factory to get a new Composer object
                $this->composer = Factory::create($this->getIO(), $this->getOptions()->composerJson()->getPath(), false);
            } catch (\InvalidArgumentException $e) {
                throw new PackageManagerException($e->getMessage(), $e->getCode(), $e);
            } catch (\Exception $e) {
                $this->app['logger.system']->critical($e->getMessage(), ['event' => 'exception', 'exception' => $e]);
                throw $e;
            }

            // Add the event subscriber
            $this->composer->getEventDispatcher()->addSubscriber($this->app['extend.listener']);

            if (!$this->app['extend.manager']->useSsl()) {
                $this->setAllowSslDowngrade(true);
            }
        }

        return $this->composer;
    }
801384
public function create()
    {
        $instance = self::createCustomerGroup($this);
        $this->setId($instance->getId());
        return $instance;
    }
983844
public function create()
    {
        $instance = self::createStoreCreditPayment($this);
        $this->setId($instance->getId());
        return $instance;
    }
384108
public function createInstance()
    {
        $classname = $this->getPlatformClassname();

        if (!class_exists($classname)) {
            throw new \Exception(
                sprintf('Unable to locate class %s', $classname)
            );
        }

        return new $classname();
    }
345832
protected function loadComposerFile() {
        $composerFile = $this->config['appDir'] . '/composer.json';

        if (!is_readable($composerFile)) {
            throw new Exception(sprintf(
                'Composer file "%s" is missing or not readable',
                $composerFile
            ), ExitApp::RUNTIME_ERROR);
        }

        $this->config['composer'] = JSONFile::read($composerFile);

        if (!array_key_exists('extra', $this->config['composer']) ||
            !is_array($this->config['composer']['extra'])) {
            throw new Exception(sprintf(
                'Missing "extra" in composer file "%s"',
                $composerFile
            ), ExitApp::RUNTIME_ERROR);
        }

        $keys = [
            'name',
            'version'
        ];

        foreach ($keys as $key) {
            if (!array_key_exists($key, $this->config['composer']['extra'])) {
                throw new Exception(sprintf(
                    'Missing "extra.%s" in composer file "%s"',
                    $key,
                    $composerFile
                ), ExitApp::RUNTIME_ERROR);
            }
        }

        return $this;
    }
594513
public function create(Composer $composer): SymbolFilterInterface
    {
        /** @var SymbolFilterInterface[] $filters */
        $filters = array_map(
            function (string $exclusion) : SymbolFilterInterface {
                $filters = [
                    new ExactSymbolFilter($exclusion),
                    new PatternSymbolFilter($exclusion)
                ];

                if (preg_match('#\\\\$#', $exclusion)) {
                    $filters[] = new NamespaceSymbolFilter($exclusion);
                }

                return new SymbolFilterChain(...$filters);
            },
            $this->getExclusions($composer)
        );

        $filters[] = new UserDefinedSymbolFilter();

        return new SymbolFilterChain(...$filters);
    }
170398
public function main()
    {
        if ($this->composer === null) {
            $this->findComposer();
        }

        $files = array();
        if (!empty($this->file) && file_exists($this->file)) {
            $files[] = $this->file;
        }

        if (!empty($this->dir)) {
            $found = $this->findFiles();
            foreach ($found as $file) {
                $files[] = $this->dir . DIRECTORY_SEPARATOR . $file;
            }
        }

        foreach ($files as $file) {

            $cmd = $this->composer . ' validate ' . $file;
            $cmd = escapeshellcmd($cmd);

            if ($this->passthru) {
                $retval = null;
                passthru($cmd, $retval);
                if ($retval == 1) {
                    throw new BuildException('invalid composer.json');
                }
            } else {
                $out = array();
                $retval = null;
                exec($cmd, $out, $retval);
                if ($retval == 1) {
                    $err = join("\n", $out);
                    throw new BuildException($err);
                } else {
                    $this->log($out[0]);
                }
            }

        }

    }
672685
public static function create()
	{
		$arguments = func_get_args();
		
		$name = array_shift( $arguments );
		
		$class_name = "Core\\CCShipyard_".ucfirst( $name );
		
		if ( !class_exists( $class_name ) )
		{
			throw new CCException( "CCShipyard - invalid builder (".$name.") given." );
		}
		
		$builder = new $class_name;
		
		call_user_func_array( array( $builder, 'create' ), $arguments );
		
		return $builder;
	}
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));
    }
651761
public function create()
    {
        if (! $this->adapter->fileExists($this->path, true)) {
            // ensure the parent directory exists
            new Directory(dirname($this->path), $this->adapter);

            if ($this->adapter->createFile($this->path) === false) {
                $this->throwUnableToCreate();
            }
        }

        return $this;
    }
282546
public function create()
    {
        if (! $this->exists() && $this->canCreate()) {
            $this->adapter->mkdir($this->path, 0755, true);
        }
        return $this;
    }
717839
public function findExtensions(): Extensions
    {
        $extensions = new Extensions();


        foreach ($this->configRepository->getPaths() as $path) {
            $composerPattern = $this->configRepository->getRootPath() . '/' . $path . '/composer.json';

            $composerFiles = $this->filesystem->glob($composerPattern);



            if ($composerFiles === false) {
                throw new ExtensionException('Error occurs when looking for extensions in the [' . $composerPattern . '] path.');
            }

            foreach ($composerFiles as $composerFile) {
                $package = $this->extensionFactory->getComposerPackage($composerFile);

                if (!in_array($package->getType(), self::$validTypes, true)) {
                    continue;
                }

                $extension = $this->extensionFactory->create($composerFile);

                if (!$this->extensionValidator->isValid($extension)) {
                    throw new ExtensionException('The extension [' . $extension->getPackage()->getName() . '] is not valid.');
                }

                $extensions->push($extension);
            }
        }

        return $extensions;
    }
1140138
public function create()
        {
            $sql = $this->generateCreateSql();
            $query = new RawQuery($sql);
            try {
                $this->drop();
                return Statement::getPreparedStatement($query)->execute();
            } catch (\Exception $e) {
                throw new Exception('Error creating table ' . $this->getB2DBName() . ': ' . $e->getMessage(), $sql);
            }
        }
391359
public static function create($composerLoaderInstance = null)
    {

        if ($composerLoaderInstance && !is_a($composerLoaderInstance, 'Composer\\Autoload\\ClassLoader'))
            throw new InvalidArgumentException(
                "Argument 1 passed to Loader->create needs to be a valid Composer\\Autoload\\ClassLoader instance"
            );

        if ($composerLoaderInstance)
            return new ComposerLoader($composerLoaderInstance);

        return new PsrLoader();
    }