GuzzleHttp\Psr7\Uri::withScheme PHP Method

withScheme() public method

public withScheme ( $scheme )
    public function withScheme($scheme)
    {
        $scheme = $this->filterScheme($scheme);
        if ($this->scheme === $scheme) {
            return $this;
        }
        $new = clone $this;
        $new->scheme = $scheme;
        $new->removeDefaultPort();
        $new->validateState();
        return $new;
    }

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function perform(OperationInterface $operation, ConfigurationInterface $configuration)
 {
     $preparedRequestParams = $this->prepareRequestParams($operation, $configuration);
     $queryString = $this->buildQueryString($preparedRequestParams, $configuration);
     $uri = new Uri(sprintf($this->requestTemplate, $configuration->getCountry(), $queryString));
     $request = new \GuzzleHttp\Psr7\Request('GET', $uri->withScheme($this->scheme), ['User-Agent' => 'ApaiIO [' . ApaiIO::VERSION . ']']);
     $result = $this->client->send($request);
     return $result->getBody()->getContents();
 }
All Usage Examples Of GuzzleHttp\Psr7\Uri::withScheme