public function __construct()

in src/GcpExtensionChannel.php [50:78]


    public function __construct($hostname = null, $opts = array())
    {
        if ($hostname == null || !is_array($opts)) {
            throw new \InvalidArgumentException("Expected hostname is empty");
        }
        $this->max_size = 10;
        $this->max_concurrent_streams_low_watermark = 100;
        if (isset($opts['affinity_conf'])) {
            if (isset($opts['affinity_conf']['channelPool'])) {
                if (isset($opts['affinity_conf']['channelPool']['maxSize'])) {
                    $this->max_size = $opts['affinity_conf']['channelPool']['maxSize'];
                }
                if (isset($opts['affinity_conf']['channelPool']['maxConcurrentStreamsLowWatermark'])) {
                    $this->max_concurrent_streams_low_watermark =
                        $opts['affinity_conf']['channelPool']['maxConcurrentStreamsLowWatermark'];
                }
            }
            $this->affinity_by_method = $opts['affinity_conf']['affinity_by_method'];
            $this->affinity_conf = $opts['affinity_conf'];
        }
        $this->target = $hostname;
        $this->affinity_key_to_channel_ref = array();
        $this->channel_refs = array();
        $this->updateOpts($opts);
        // Initiate a Grpc\Channel at the beginning in order to keep the same
        // behavior as the Grpc.
        $channel_ref = $this->getChannelRef();
        $channel_ref->getRealChannel($this->credentials);
    }