Creates a composer from a kind.
@param string $kind
@return Composer
161174
public static function fromKind($kind) {
        $composerMap = self::getComposerMap();
        if (!array_key_exists($kind, $composerMap))
            throw new ComposerException("no composer found for \"$kind\"");
        $class = $composerMap[$kind];
        return new $class();
    }
492706
public function composer()
    {
        if (is_null($this->composer)) {
            $this->composer = app(Composer::class);
        }

        return $this->composer;
    }
998599
protected function composer($key = null)
    {
        if (! $this->composerJson) {
            $composerFile = $this->realPath().'/composer.json';
            if (! file_exists($composerFile)) {
                return null;
            }
            $this->composerJson = json_decode(file_get_contents($composerFile), true);
        }

        return $key ? array_get($this->composerJson, $key) : $this->composerJson;
    }
994399
public function create(Composer $composer): FileIteratorInterface
    {
        $config              = $composer->getConfig();
        $autoloadGenerator   = $composer->getAutoloadGenerator();
        $installationManager = $composer->getInstallationManager();
        $package             = $composer->getPackage();

        $autoloadGenerator->setClassMapAuthoritative(
            $config->get('classmap-authoritative')
        );
        $autoloadGenerator->setDevMode(false);

        $packageMap = $autoloadGenerator->buildPackageMap(
            $installationManager,
            $package,
            [$package]
        );

        $directives = $autoloadGenerator->parseAutoloads($packageMap, $package);

        $files = new AppendIterator();

        $files->append(
            $this->createClassmapIterator(
                $directives['classmap'] ?? [],
                $directives['exclude-from-classmap'] ?? []
            )
        );
        $files->append(
            $this->createFilesIterator(
                ...array_values($directives['files'] ?? [])
            )
        );
        $files->append(
            $this->createNamespaceIterator($directives['psr-0'] ?? [])
        );
        $files->append(
            $this->createNamespaceIterator($directives['psr-4'] ?? [])
        );

        return new FileIterator($files);
    }
688337
protected function expect(string $kind): Token
    {
        $token = $this->lexer->getToken();

        if ($kind === $token->getKind()) {
            $this->lexer->advance();
            return $token;
        }

        throw $this->lexer->createSyntaxErrorException(\sprintf('Expected %s, found %s.', $kind, $token));
    }
725482
public static function make(string $country = null)
    {
        if (empty($country)) {
            $country = config('default');
        }

        return (new static() )->setCurrency($country);
    }
896212
protected function buildCreative($type)
    {
        // check type
        $creativeClassName = $this->buildCreativeClassName($type);
        if (!class_exists($creativeClassName)) {
            throw new \Exception('Wrong creative specified: ' . var_export($creativeClassName, true));
        }

        // get container
        if (!$this->creativesDomElement) {
            // get creatives tag
            $this->creativesDomElement = $this->adDomElement->getElementsByTagName('Creatives')->item(0);
            if (!$this->creativesDomElement) {
                $this->creativesDomElement = $this->adDomElement->ownerDocument->createElement('Creatives');
                $this->getDomElement()->appendChild($this->creativesDomElement);
            }
        }

        // Creative dom element: <Creative></Creative>
        $creativeDomElement = $this->creativesDomElement->ownerDocument->createElement('Creative');
        $this->creativesDomElement->appendChild($creativeDomElement);

        // Creative type dom element: <Creative><Linear></Linear></Creative>
        $creativeTypeDomElement = $this->adDomElement->ownerDocument->createElement($type);
        $creativeDomElement->appendChild($creativeTypeDomElement);

        // object
        $creative = new $creativeClassName($creativeDomElement);
        $this->creatives[] = $creative;

        return $creative;
    }
141085
public static function create($token): self
    {
        $token = $token instanceof RegistrationToken ? $token : RegistrationToken::fromValue($token);

        return new self($token);
    }
962770
public function make($file)
	{
		if ($file instanceof SymfonyUploadedFile) {
			return $this->createFromObject($file);
		}

		if (is_array($file)) {
			return $this->createFromArray($file);
		}

		if (substr($file, 0, 7) == "http://" || substr($file, 0, 8) == "https://") {
			return $this->createFromUrl($file);
		}

		return $this->createFromString($file);
	}
975816
private function composer()
    {
        $composer_file = $this->composerFile();

        return file_exists($composer_file)
            ? ComposerConfig::createFromFile($composer_file)
            : new ComposerConfig();
    }
1365993
public function createInstanceByQueryString($query)
    {
        switch ($this->rdfHelpers->getQueryType($query)) {
            case 'askQuery':
                return new AskQueryImpl($query, $this->rdfHelpers);

            case 'constructQuery':
                return new ConstructQueryImpl($query, $this->rdfHelpers);

            case 'describeQuery':
                return new DescribeQueryImpl($query, $this->rdfHelpers);

            case 'graphQuery':
                return new GraphQueryImpl($query, $this->rdfHelpers);

            case 'selectQuery':
                return new SelectQueryImpl($query, $this->rdfHelpers);

            case 'updateQuery':
                return new UpdateQueryImpl($query, $this->rdfHelpers);

            default:
                throw new \Exception('Unknown query type: '.$query);
        }
    }
1040852
public function factory($type, $level = 0)
    {
        $result = null;

        if (!array_key_exists('type_extended_' . $type, $this->types)) {
            throw new InvalidTypeException;
        }

        /** @var $result ExtendedTypeInterface */
        $result = clone($this->types['type_extended_' . $type]);
        $result->setLevel($level);

        return $result;
    }
341914
private function eat(...$kinds) {
        $token = $this->token;
        if (\is_array($kinds[0])) {
            $kinds = $kinds[0];
        }
        foreach ($kinds as $kind) {
            if ($token->kind === $kind) {
                $this->token = $this->lexer->scanNextToken();
                return $token;
            }
        }
        // TODO include optional grouping for token kinds
        return new MissingToken($kinds[0], $token->fullStart);
    }
39230
public static function fromArray(array $data)
    {
        return new PhpCsFixerLevels(
            new Level($data['psr0']),
            new Level($data['psr1']),
            new Level($data['psr2']),
            new Level($data['symfony'])
        );
    }
465512
public static function create(array $parts)
    {
        if (0 === \count($parts)) {
            throw new CrunzException('At least one part expected.');
        }

        $normalizedPath = \str_replace(
            DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR,
            DIRECTORY_SEPARATOR,
            \implode(DIRECTORY_SEPARATOR, $parts)
        );

        return new self($normalizedPath);
    }
146201
public function getComposer($required = true, $disablePlugins = false)
    {
        if (null === $this->composer) {
            if ($this->composerFactory) {
                $this->composer = call_user_func($this->composerFactory, $required, $disablePlugins);
            }

            if ($required && !$this->composer) {
                throw new \RuntimeException(
                    'You must define a factory closure for wrapped commands to retrieve the ' .
                    'composer instance.'
                );
            }
        }

        return $this->composer;
    }
1028874
public function createFromComposer($file = 'composer.json'){
		$composer = $this->readComposerDotJson($file);
		
		//Default values
		$this->setNamespace('');
		$this->setDestinationFolder('generated\\');
		
		if(isset($composer['extra']) && isset($composer['extra']['paris-model-generator'])){
			$configuration = $composer['extra']['paris-model-generator'];
				
			//Namespace
			if(isset($configuration['namespace'])){
				$this->setNamespace($configuration['namespace']);
			}
				
			//Destination Folder
			if(isset($configuration['destination-folder'])){
				$this->setDestinationFolder($configuration['destination-folder']);
			}
		}
		
		//Licenses
		if(isset($composer['license'])){
			$licenses = $composer['license'];
				
			if(!is_array($licenses)){
				$licenses = array($licenses);
			}
				
			//Convert to another format
			foreach ($licenses as $license){
				$tag = array(
						'name'        => 'license',
						'description' => $license,
				);
				$this->addTag($tag);
			}
		}
		
		//Authors
		if(isset($composer['authors'])){
			$authors = $composer['authors'];
				
			//Authors
			foreach ($authors as $author){
				$tag = array(
						'name'        => 'author',
						'description' => $author['name'] . ' <' . $author['email'] . '>',
				);
				$this->addTag($tag);
			}
		}
	}