コード例 #1
0
 /**
  * Should return (one of)
  *      array of \App\Service\Vagrant\Host
  *      null, if no input is given (empty identifier)
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return null|array(\App\Service\Vagrant\Host)
  */
 public function getHostList(InputInterface $input, OutputInterface $output)
 {
     $vagrant = new Vagrant();
     $inputStr = $input->getArgument("identifier");
     if ($inputStr === null) {
         return null;
     } else {
         $hosts = [];
         # handle all boxes that match the inputStr
         foreach ($vagrant->resolveStr($inputStr) as $id) {
             /** @var \App\Service\Vagrant\Host $host */
             $host = $vagrant->lookupBox($id);
             $hosts[] = $host;
             unset($host);
         }
         return $hosts;
     }
 }