Get the composer command for the environment.

@return string
322317
protected function findComposer()
    {
        if ($this->files->exists($this->workingPath.'/composer.phar')) {
            return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)).' composer.phar';
        }

        return 'composer';
    }
746538
public function getEnv()
    {
        if (Request::isCli()) {
            return 'cli';
        }

        if (isset($_SERVER['SERVER_NAME'])) {
            $host = $_SERVER['SERVER_NAME'];
        } else {
            $host = $_SERVER['HTTP_HOST'];
            if ($_SERVER['SERVER_PORT'] != 80) {
                $host = explode(':', $host);
                $host = $host[0];
            }
        }

        switch ($host) {
            case $_SERVER['SERVER_ADDR'] :
                // no break
            case '127.0.0.1':
                //no break
            case 'localhost':
                return 'development';
        }

        $domain = substr($host, strrpos($host, '.') + 1);

        if ($domain == 'dev' || $domain == 'loc' || $domain == 'test') {
            return 'development';
        }

        if (substr($_SERVER['HTTP_HOST'], 0, 7) == '192.168') {
            return 'development';
        }
        return 'product';
    }
692148
public function getTwig(): \Twig_Environment
    {
        if (is_null($this->twig)) {
            // Init Twig
            $this->twigLoader = new \Twig_Loader_Filesystem();
            $this->twig = new \Twig_Environment($this->twigLoader);
        }

        return $this->twig;
    }
1191393
public function getVersion()
    {
        $process = $this->getProcess();
        $processCommand = trim($this->findComposer() . ' --version');
        $process->setCommandLine($processCommand);
        $this->log->info('Running Composer command', ['command' => $processCommand]);
        $process->run();

        if ($process->isSuccessful() == false) {
            $composerError = remove_ansi($process->getErrorOutput());
            $this->log->error('Composer version process failure', ['composer' => $composerError]);
            throw new ComposerException('There was an error retrieving the Composer version');
        }

        return $process->getOutput();
    }
1277969
public function getVersion()
	{
		$filename = dirname( $this->container->get( 'kernel' )->getRootDir() ) . DIRECTORY_SEPARATOR . 'composer.lock';

		if( file_exists( $filename ) === true && ( $content = file_get_contents( $filename ) ) !== false
			&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
		) {
			foreach( (array) $content['packages'] as $item )
			{
				if( $item['name'] === 'aimeos/aimeos-symfony' ) {
					return $item['version'];
				}
			}
		}

		return '';
	}
1257533
public function getBuiltCommand()
    {
        $cmd = $this->command;

        foreach ($this->arguments as $argument) {
            $os = $argument->getOs();

            if ($os && !($os & $this->os->getType())) {
                continue;
            }

            $key = $argument->getKey();
            $prefix = $argument->getPrefix();

            if ($argument->willEscape() === true || ($argument->willEscape() === null && ($this->flags & ESCAPE))) {
                $key = $this->escapeshellarg($key);
            }
            $key = $prefix.$key;

            $values = $argument->getValues();

            if (empty($values)) {
                $cmd .= " $key";
                continue;
            }

            foreach ($values as $val) {
                $cmd .= " $key";
                $cmd .= ($this->flags & DONT_ADD_SPACE_BEFORE_VALUE) ? '' : ' ';
                if ($argument->willEscape() === true || ($argument->willEscape() === null && ($this->flags & ESCAPE))) {
                    $val = $this->escapeshellarg($val);
                }
                $cmd .= $val;
            }
        }

        return trim($cmd);
    }
907244
protected function defaultCacheDir()
    {
        $cacheDir = getenv('COMPOSER_CACHE_DIR');
        if ($cacheDir) {
            return $cacheDir;
        }

        $home = getenv('COMPOSER_HOME');
        $isWindows = defined('PHP_WINDOWS_VERSION_MAJOR');

        if (!$home) {
            if ($isWindows) {
                if ($envAppData = getenv('APPDATA')) {
                    $home = strtr($envAppData, '\\', '/') . '/Composer';
                }
            } elseif ($envHome = getenv('HOME')) {
                $home = rtrim($envHome, '/') . '/.composer';
            }
        }

        if ($home && !$cacheDir) {
            if ($isWindows) {
                if ($cacheDir = getenv('LOCALAPPDATA')) {
                    $cacheDir .= '/Composer';
                } else {
                    $cacheDir = $home . '/cache';
                }

                $cacheDir = strtr($cacheDir, '\\', '/');
            } else {
                $cacheDir = $home . '/cache';
            }
        }

        if (!$cacheDir) {
            return null;
        }

        return $cacheDir;
    }
668389
private function getCommandNamespace(array $composer)
    {
        if(! $this->isset('autoload.psr-4', $composer)) {
            return null;
        }

        foreach($composer['autoload']['psr-4'] as $namespace => $folder) {
            if($folder === 'src/') return $namespace . 'Commands\\';
        }
        return null;
    }
1068007
protected function discoverSystemEnvironment()
    {
        $env = [];
        $output = shell_exec('env');
        if ($output) {
            $lines = explode("\n", $output);
            foreach ($lines as $line) {
                $values = explode('=', $line);
                if (!empty($values[0]) && !empty($values[1])) {
                    $env[$values[0]] = $values[1];
                }
            }
        }
        return $env;
    }
943060
public function getCommand()
    {
        $path    = $this->getPath();
        $options = $this->getOptions();

        $this->validateExecutable($path);

        if ($this->cache) {
            array_push($options, '--disk-cache=true');
        }

        if ($this->debug) {
            array_push($options, '--debug=true');
        }

        return sprintf('%s %s', $path, implode(' ', $options));
    }
765963
public function getComposerPackageData()
    {
        $moduleVersions = [];

        $installedJsonFile = getcwd() . '/../vendor/composer/installed.json';
        $packages = json_decode(file_get_contents($installedJsonFile));

        if (count($packages) > 0) {
            foreach ($packages as $package) {
                $name = $package->name;

                /**
                 * get latest stable version of the package
                 */
                $latestStable = $this->getLatestPackage($name);

                /**
                 * prepare result
                 */
                $moduleVersions[] = [
                    'name' => $name,
                    'installed_version' => $package->version,
                    'installed_version_licences' => $package->license,
                    'newest_version' => $latestStable->version,
                    'newest_version_licences' => $latestStable->license,
                ];
            }
        }

        return $moduleVersions;
    }
1333377
public function getShortCommand(): string
    {
        $command = $this->getFullCommand();
        $command = substr($command, 0, strpos($command, '>'));
        $command = trim(str_replace(
            config('schedule-list.remove_strings_from_command', [
                "'".PHP_BINARY."'",
                "'artisan'",
            ]), '', $command)
        );

        return $command;
    }
173345
public function getCommand() : string
    {
        return $this->cmd
        . (count($this->options)   ? ' ' . implode(' ', $this->options)   : '')
        . ($this->isSilent         ? ' 2> /dev/null'                      : '');
    }
719590
public function getComposer()
    {
        $composerFile = new SplFileInfo($this->composer);
        if (false === $composerFile->isFile()) {
            $message = sprintf('Composer binary not found at "%s"', $composerFile);
            $this->log($message, Project::MSG_WARN);
            $composerLocation = FileSystem::getFileSystem()->which('composer');
            if (!empty($composerLocation)) {
                $message = sprintf('Composer binary found at "%s", updating location', $composerLocation[0]);
                $this->log($message, Project::MSG_INFO);
                $this->setComposer($composerLocation);
            }
        }
        return $this->composer;
    }
1213211
protected function getEnvironments() {
        if (!$this->_environments) {
            $this->_environments = new EnvironmentList($this->version, $this->solution['sid']);
        }

        return $this->_environments;
    }
724652
protected function generateEnv()
    {
        $env = null;

        // Get the existing .env file contents to replace
        $envPath = $this->laravel->environmentFilePath();

        if (! file_exists($envPath)) {
            // Create the .env file from the example file
            copy($envPath.'.example', $envPath);
            $this->callSilent('key:generate', ['--force' => true]);
        }

        $env = file_get_contents($envPath);

        // Loop over all of the keys we can set and replace the values that are set
        foreach ($this->keys as $key => $var) {
            // Skip if it's not set
            if (! isset($this->$var)) {
                continue;
            }

            $env = preg_replace(
                $this->keyReplacementPattern($key),
                $key.'='.(is_string($this->$var) ? '"'.$this->$var.'"' : $this->$var),
                $env,
                1
            );
        }

        return $env;
    }
1320048
protected function getCommandFactory()
    {
        if (!$this->commandFactory) {
            $this->commandFactory = CompositeFactory::getDefaultChain($this);
        }

        return $this->commandFactory;
    }