Laravel\Envoy\TaskContainer::getServer PHP Метод

getServer() публичный Метод

Get the IP address for a server.
public getServer ( string $server ) : string | null
$server string
Результат string | null
    public function getServer($server)
    {
        if (!array_key_exists($server, $this->servers)) {
            throw new \Exception('Server [' . $server . '] is not defined.');
        }
        return array_get($this->servers, $server);
    }

Usage Example

Пример #1
0
 /**
  * Get the server from the task container.
  *
  * @param  \Laravel\Envoy\TaskContainer  $container
  * @return string
  */
 protected function getServer(TaskContainer $container)
 {
     if ($this->argument('name')) {
         return $container->getServer($this->argument('name'));
     } elseif ($container->hasOneServer()) {
         return $container->getFirstServer();
     } else {
         throw new \InvalidArgumentException('Please provide a server name.');
     }
 }