aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php
diff options
context:
space:
mode:
authorGravatar Julien Boeuf <jboeuf@google.com>2015-11-17 18:53:55 -0800
committerGravatar Julien Boeuf <jboeuf@google.com>2015-11-17 18:53:55 -0800
commit802f6b672456610ba4366b7b953399749a5774d6 (patch)
treeab90250fcbdcdc41b7da4bf9aba779181d797689 /src/php
parent334314b8887da1b082777c69945dead45182af7f (diff)
parent7fc77e06ba5becaebb66aa3d83b5bf7d26a94ddc (diff)
Merge branch 'master' of https://github.com/grpc/grpc into update_ssl_cert
Diffstat (limited to 'src/php')
-rwxr-xr-xsrc/php/lib/Grpc/BaseStub.php8
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);
}