Exemplo n.º 1
0
 /**
  * Returns the configured hosts for $stage.
  *
  * @param string $stage
  *
  * @return Host[]
  *
  * @throws UnexpectedValueException when $stage is not a valid type
  */
 public function getHostsByStage($stage)
 {
     if (Host::isValidStage($stage) === false) {
         throw new UnexpectedValueException(sprintf("'%s' is not a valid stage.", $stage));
     }
     $hosts = array();
     foreach ($this->getHosts() as $host) {
         if ($host->getStage() === $stage) {
             $hosts[] = $host;
         }
     }
     return $hosts;
 }