Merge pull request #15417 from chingor13/php-default-channel

PHP: Surface a static method to fetch the default Channel
reviewable/pr15341/r3
Zhouyihai Ding 7 years ago committed by GitHub
commit 10470bb4a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/php/lib/Grpc/BaseStub.php

@ -69,6 +69,18 @@ class BaseStub
return;
}
$this->channel = static::getDefaultChannel($hostname, $opts);
}
/**
* Creates and returns the default Channel
*
* @param array $opts Channel constructor options
*
* @return Channel The channel
*/
public static function getDefaultChannel($hostname, array $opts)
{
$package_config = json_decode(
file_get_contents(dirname(__FILE__).'/../../composer.json'),
true
@ -85,7 +97,7 @@ class BaseStub
'required. Please see one of the '.
'ChannelCredentials::create methods');
}
$this->channel = new Channel($hostname, $opts);
return new Channel($hostname, $opts);
}
/**

Loading…
Cancel
Save