Пример #1
0
 /**
  * If --stability VALUE is provided, then run a `composer config minimum-stability VALUE`
  * command to configure composer.json appropriately.
  *
  * @param string $execPath The path to composer
  * @param array $composerArgs Anything from the global $argv to be passed
  *   on to Composer
  * @param array $projects A list of projects to install, with the key
  *   specifying the project name, and the value specifying its version.
  * @param array $options User options from the command line; see
  *   $optionDefaultValues in the main() function.
  * @return array
  */
 public function configureProjectStability($execPath, $composerArgs, $projects, $options)
 {
     $globalBaseDir = $options['base-dir'];
     $stability = $options['stability'];
     $result = array();
     $env = array();
     foreach ($projects as $project => $version) {
         $installLocation = "{$globalBaseDir}/{$project}";
         FileSystemUtils::mkdirParents($installLocation);
         if (!file_exists("{$installLocation}/composer.json")) {
             file_put_contents("{$installLocation}/composer.json", '{}');
         }
         $result[] = $this->buildConfigCommand($execPath, $composerArgs, 'minimum-stability', $stability, $env, $installLocation);
     }
     return $result;
 }