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 downloded. * * @return int Return status from Composer. * @throws \Symfony\Component\Process\Exception\LogicException * @throws \Symfony\Component\Process\Exception\RuntimeException */ 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-source'; } $this->output->writeln('Running composer install process...'); $process = new Process($command); $process->run(function ($type, $buffer) { if (Process::ERR === $type) { echo $buffer; } }); return $process->getOutput(); } protected function initialiseGit() { if (! ($this->git instanceof Git)) { $this->git = new Git(); } } }