php: metadata plugin based auth API
diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php
index 53849d5..c80cf44 100644
--- a/src/php/lib/Grpc/AbstractCall.php
+++ b/src/php/lib/Grpc/AbstractCall.php
@@ -43,19 +43,20 @@
     /**
      * Create a new Call wrapper object.
      *
-     * @param Channel         $channel     The channel to communicate on
-     * @param string          $method      The method to call on the
-     *                                     remote server
-     * @param callback        $deserialize A callback function to deserialize
-     *                                     the response
-     * @param (optional) long $timeout     Timeout in microseconds
+     * @param Channel  $channel     The channel to communicate on
+     * @param string   $method      The method to call on the
+     *                              remote server
+     * @param callback $deserialize A callback function to deserialize
+     *                              the response
+     * @param array    $options     Call options (optional)
      */
     public function __construct(Channel $channel,
                                 $method,
                                 $deserialize,
-                                $timeout = false)
+                                $options = [])
     {
-        if ($timeout) {
+        if (isset($options['timeout']) &&
+            is_numeric($timeout = $options['timeout'])) {
             $now = Timeval::now();
             $delta = new Timeval($timeout);
             $deadline = $now->add($delta);
@@ -65,6 +66,13 @@
         $this->call = new Call($channel, $method, $deadline);
         $this->deserialize = $deserialize;
         $this->metadata = null;
+        if (isset($options['call_credentials_callback']) &&
+            is_callable($call_credentials_callback =
+                        $options['call_credentials_callback'])) {
+            $call_credentials = CallCredentials::createFromPlugin(
+                $call_credentials_callback);
+            $this->call->setCredentials($call_credentials);
+        }
     }
 
     /**