aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/lib
diff options
context:
space:
mode:
authorGravatar Stanley Cheung <stanleycheung@google.com>2015-12-16 12:58:19 -0800
committerGravatar Stanley Cheung <stanleycheung@google.com>2015-12-16 12:58:19 -0800
commit6bd3180dfdda95d9ce824c88579f2dca87a65302 (patch)
treeb763e15aa47fadcc79f087ecbc319df75c1db591 /src/php/lib
parent5ff97a27a9a6d6516b9a2fa36c8e9995b0e05a59 (diff)
php: make channel
credentials createInsecure explicit
Diffstat (limited to 'src/php/lib')
-rw-r--r--src/php/lib/Grpc/AbstractCall.php11
-rwxr-xr-xsrc/php/lib/Grpc/BaseStub.php5
2 files changed, 16 insertions, 0 deletions
diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php
index c80cf4464e..712af91eb2 100644
--- a/src/php/lib/Grpc/AbstractCall.php
+++ b/src/php/lib/Grpc/AbstractCall.php
@@ -114,4 +114,15 @@ abstract class AbstractCall
return call_user_func($this->deserialize, $value);
}
+
+ /**
+ * Set the CallCredentials for the underlying Call.
+ *
+ * @param CallCredentials $call_credentials The CallCredentials
+ * object
+ */
+ public function setCallCredentials($call_credentials)
+ {
+ $this->call->setCredentials($call_credentials);
+ }
}
diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php
index 8e9dedf73b..2de1b337e5 100755
--- a/src/php/lib/Grpc/BaseStub.php
+++ b/src/php/lib/Grpc/BaseStub.php
@@ -72,6 +72,11 @@ class BaseStub
}
$opts['grpc.primary_user_agent'] .=
'grpc-php/'.$package_config['version'];
+ if (!array_key_exists('credentials', $opts)) {
+ throw new \Exception("The opts['credentials'] key is now ".
+ 'required. Please see one of the '.
+ 'ChannelCredentials::create methods');
+ }
$this->channel = new Channel($hostname, $opts);
}