You are here

public function Client::__call in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/guzzle/src/Client.php \GuzzleHttp\Client::__call()

File

vendor/guzzlehttp/guzzle/src/Client.php, line 76

Class

Client
@method ResponseInterface get($uri, array $options = []) @method ResponseInterface head($uri, array $options = []) @method ResponseInterface put($uri, array $options = []) @method ResponseInterface post($uri, array $options = []) @method…

Namespace

GuzzleHttp

Code

public function __call($method, $args) {
  if (count($args) < 1) {
    throw new \InvalidArgumentException('Magic request methods require a URI and optional options array');
  }
  $uri = $args[0];
  $opts = isset($args[1]) ? $args[1] : [];
  return substr($method, -5) === 'Async' ? $this
    ->requestAsync(substr($method, 0, -5), $uri, $opts) : $this
    ->request($method, $uri, $opts);
}