|
|
|
@ -54,6 +54,18 @@ class BaseStub |
|
|
|
|
} |
|
|
|
|
unset($opts['update_metadata']); |
|
|
|
|
} |
|
|
|
|
if (!empty($opts['grpc.ssl_target_name_override'])) { |
|
|
|
|
$this->hostname_override = $opts['grpc.ssl_target_name_override']; |
|
|
|
|
} |
|
|
|
|
if ($channel) { |
|
|
|
|
if (!is_a($channel, 'Grpc\Channel')) { |
|
|
|
|
throw new \Exception('The channel argument is not a'. |
|
|
|
|
'Channel object'); |
|
|
|
|
} |
|
|
|
|
$this->channel = $channel; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$package_config = json_decode( |
|
|
|
|
file_get_contents(dirname(__FILE__).'/../../composer.json'), true); |
|
|
|
|
if (!empty($opts['grpc.primary_user_agent'])) { |
|
|
|
@ -61,9 +73,6 @@ class BaseStub |
|
|
|
|
} else { |
|
|
|
|
$opts['grpc.primary_user_agent'] = ''; |
|
|
|
|
} |
|
|
|
|
if (!empty($opts['grpc.ssl_target_name_override'])) { |
|
|
|
|
$this->hostname_override = $opts['grpc.ssl_target_name_override']; |
|
|
|
|
} |
|
|
|
|
$opts['grpc.primary_user_agent'] .= |
|
|
|
|
'grpc-php/'.$package_config['version']; |
|
|
|
|
if (!array_key_exists('credentials', $opts)) { |
|
|
|
@ -71,15 +80,7 @@ class BaseStub |
|
|
|
|
'required. Please see one of the '. |
|
|
|
|
'ChannelCredentials::create methods'); |
|
|
|
|
} |
|
|
|
|
if ($channel) { |
|
|
|
|
if (!is_a($channel, 'Grpc\Channel')) { |
|
|
|
|
throw new \Exception('The channel argument is not a'. |
|
|
|
|
'Channel object'); |
|
|
|
|
} |
|
|
|
|
$this->channel = $channel; |
|
|
|
|
} else { |
|
|
|
|
$this->channel = new Channel($hostname, $opts); |
|
|
|
|
} |
|
|
|
|
$this->channel = new Channel($hostname, $opts); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|