getAliases() public méthode

public getAliases ( string $groupName ) : string | boolean
$groupName string
Résultat string | boolean
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $projectRoot = $this->getProjectRoot();
     if (!$projectRoot) {
         throw new RootNotFoundException();
     }
     $projectConfig = LocalProject::getProjectConfig($projectRoot);
     $current_group = isset($projectConfig['alias-group']) ? $projectConfig['alias-group'] : $projectConfig['id'];
     if ($input->getOption('pipe')) {
         $output->writeln($current_group);
         return 0;
     }
     $project = $this->getCurrentProject();
     $new_group = ltrim($input->getOption('group'), '@');
     $homeDir = $this->getHomeDir();
     $drushHelper = new DrushHelper($output);
     $drushHelper->ensureInstalled();
     $drushHelper->setHomeDir($homeDir);
     $aliases = $drushHelper->getAliases($current_group);
     if ($new_group && $new_group != $current_group || !$aliases || $input->getOption('recreate')) {
         $new_group = $new_group ?: $current_group;
         $this->stdErr->writeln("Creating Drush aliases in the group <info>@{$new_group}</info>");
         $questionHelper = $this->getHelper('question');
         if ($new_group != $current_group) {
             $existing = $drushHelper->getAliases($new_group);
             if ($existing && $new_group != $current_group) {
                 $question = "The Drush alias group <info>@{$new_group}</info> already exists. Overwrite?";
                 if (!$questionHelper->confirm($question, $input, $output, false)) {
                     return 1;
                 }
             }
             LocalProject::writeCurrentProjectConfig('alias-group', $new_group, $projectRoot);
         }
         $environments = $this->getEnvironments($project, true, false);
         $drushHelper->createAliases($project, $projectRoot, $environments, $current_group);
         if ($new_group != $current_group) {
             $drushDir = $homeDir . '/.drush';
             $oldFile = $drushDir . '/' . $current_group . '.aliases.drushrc.php';
             if (file_exists($oldFile)) {
                 if ($questionHelper->confirm("Delete old Drush alias group <info>@{$current_group}</info>?", $input, $this->stdErr)) {
                     unlink($oldFile);
                 }
             }
         }
         // Clear the Drush cache now that the aliases have been updated.
         $drushHelper->clearCache();
         // Read the new aliases.
         $aliases = $drushHelper->getAliases($new_group);
     }
     if ($aliases) {
         $this->stdErr->writeln("Drush aliases for <info>{$project->title}</info> ({$project->id}):");
         foreach (explode("\n", $aliases) as $alias) {
             $output->writeln('    @' . $alias);
         }
     }
     return 0;
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $project = $this->getCurrentProject();
     if (!$project) {
         throw new \Exception('This can only be run from inside a project directory');
     }
     $projectRoot = $this->getProjectRoot();
     $projectConfig = LocalProject::getProjectConfig($projectRoot);
     $current_group = isset($projectConfig['alias-group']) ? $projectConfig['alias-group'] : $project['id'];
     if ($input->getOption('pipe') || !$this->isTerminal($output)) {
         $output->writeln($current_group);
         return 0;
     }
     $new_group = ltrim($input->getOption('group'), '@');
     $homeDir = $this->getHelper('fs')->getHomeDirectory();
     $drushHelper = new DrushHelper($output);
     $drushHelper->ensureInstalled();
     $drushHelper->setHomeDir($homeDir);
     if ($new_group && $new_group != $current_group) {
         $questionHelper = $this->getHelper('question');
         $existing = $drushHelper->getAliases($new_group);
         if ($existing) {
             if (!$questionHelper->confirm("The alias group <info>@{$new_group}</info> already exists. Overwrite?", $input, $output, false)) {
                 return 1;
             }
         }
         $project['alias-group'] = $new_group;
         LocalProject::writeCurrentProjectConfig('alias-group', $new_group, $projectRoot);
         $output->write("Creating Drush aliases in the group <info>@{$new_group}</info>...");
         $environments = $this->getEnvironments($project, true, false);
         $drushHelper->createAliases($project, $projectRoot, $environments);
         $output->writeln(" done");
         $drushDir = $homeDir . '/.drush';
         $oldFile = $drushDir . '/' . $current_group . '.aliases.drushrc.php';
         if (file_exists($oldFile)) {
             if ($questionHelper->confirm("Delete old alias group <info>@{$current_group}</info>?", $input, $output)) {
                 unlink($oldFile);
             }
         }
         // Clear the Drush cache now that the aliases have been updated.
         $drushHelper->clearCache();
         $current_group = $new_group;
     } elseif ($input->getOption('recreate')) {
         $output->write("Recreating Drush aliases...");
         $environments = $this->getEnvironments($project, true, false);
         $drushHelper->createAliases($project, $projectRoot, $environments);
         $drushHelper->clearCache();
         $output->writeln(' done');
     }
     // Don't run expensive drush calls if they are not needed.
     if ($input->getOption('quiet')) {
         return 0;
     }
     $aliases = $drushHelper->getAliases($current_group);
     if ($aliases) {
         $output->writeln("Aliases for <info>{$project['name']}</info> ({$project['id']}):");
         foreach (explode("\n", $aliases) as $alias) {
             $output->writeln('    @' . $alias);
         }
     }
     return 0;
 }