composer(); } /** * Issues the command to 'install' the composer package. * * It first checks the current branch for stable versions. If found then the '--no-dev' * option is added to the command to prevent development packages being also downloaded. * * @return string * * @throws \Cz\Git\GitException */ protected function composer() { $this->initialiseGit(); $command = 'composer install'; if (\in_array($this->gitBranch, $this->git->getBranchesStable(), false)) { $command .= ' --prefer-dist --no-dev'; } else { $command .= ' --prefer-dist'; } $this->output->writeln('Running composer install process...'); $process = Process::fromShellCommandline('exec '.$command); $process->setTimeout(360); $process->run(function ($type, $buffer) { if (Process::ERR === $type) { echo $buffer; } }); return $process->getOutput(); } /** * @throws \Cz\Git\GitException */ protected function initialiseGit() { if (! ($this->git instanceof Git)) { $this->git = new Git(); } } }