Grpc\AbstractCall::__construct PHP Method

__construct() public method

Create a new Call wrapper object.
public __construct ( Channel $channel, string $method, callback $deserialize, array $options = [] )
$channel Channel The channel to communicate on
$method string The method to call on the remote server
$deserialize callback A callback function to deserialize the response
$options array Call options (optional)
    public function __construct(Channel $channel, $method, $deserialize, $options = [])
    {
        if (array_key_exists('timeout', $options) && is_numeric($timeout = $options['timeout'])) {
            $now = Timeval::now();
            $delta = new Timeval($timeout);
            $deadline = $now->add($delta);
        } else {
            $deadline = Timeval::infFuture();
        }
        $this->call = new Call($channel, $method, $deadline);
        $this->deserialize = $deserialize;
        $this->metadata = null;
        $this->trailing_metadata = null;
        if (array_key_exists('call_credentials_callback', $options) && is_callable($call_credentials_callback = $options['call_credentials_callback'])) {
            $call_credentials = CallCredentials::createFromPlugin($call_credentials_callback);
            $this->call->setCredentials($call_credentials);
        }
    }