GuzzleHttp\Psr7\Uri::getPort PHP Method

getPort() public method

public getPort ( )
    public function getPort()
    {
        return $this->port;
    }

Usage Example

Example #1
0
 public function __construct(Options $options, OutputInterface $ouput)
 {
     $timeout = $options->getTimeout();
     $client = new ClientGuzzle(['timeout' => $timeout]);
     $url = $options->getUrl();
     $response = $client->get($url);
     if ($response->getStatusCode() != 200) {
         throw new RuntimeException(sprintf('Cannot access this url: "%s"', $url));
     }
     $uri = new Uri($url);
     $baseUri = $uri->getScheme() . '://' . $uri->getHost();
     if (!empty($uri->getPort())) {
         $baseUri .= ':' . $uri->getPort();
     }
     $options->setBaseUri($baseUri);
     $this->options = $options;
     $this->output = $ouput;
 }
All Usage Examples Of GuzzleHttp\Psr7\Uri::getPort