diff options
author | Julien Boeuf <jboeuf@google.com> | 2015-11-17 18:53:55 -0800 |
---|---|---|
committer | Julien Boeuf <jboeuf@google.com> | 2015-11-17 18:53:55 -0800 |
commit | 802f6b672456610ba4366b7b953399749a5774d6 (patch) | |
tree | ab90250fcbdcdc41b7da4bf9aba779181d797689 /src/php | |
parent | 334314b8887da1b082777c69945dead45182af7f (diff) | |
parent | 7fc77e06ba5becaebb66aa3d83b5bf7d26a94ddc (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into update_ssl_cert
Diffstat (limited to 'src/php')
-rwxr-xr-x | src/php/lib/Grpc/BaseStub.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index c26be607ff..aa4de349ea 100755 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -51,6 +51,7 @@ class BaseStub * @param $opts array * - 'update_metadata': (optional) a callback function which takes in a * metadata array, and returns an updated metadata array + * - 'grpc.primary_user_agent': (optional) a user-agent string */ public function __construct($hostname, $opts) { @@ -64,7 +65,12 @@ class BaseStub } $package_config = json_decode( file_get_contents(dirname(__FILE__).'/../../composer.json'), true); - $opts['grpc.primary_user_agent'] = + if (!empty($opts['grpc.primary_user_agent'])) { + $opts['grpc.primary_user_agent'] .= ' '; + } else { + $opts['grpc.primary_user_agent'] = ''; + } + $opts['grpc.primary_user_agent'] .= 'grpc-php/'.$package_config['version']; $this->channel = new Channel($hostname, $opts); } |