private function parseConfObject()

in src/Config.php [92:111]


    private function parseConfObject($conf_object)
    {
        $config = json_decode($conf_object->serializeToJsonString(), true);
        if (isset($config['channelPool'])) {
            $affinity_conf['channelPool'] = $config['channelPool'];
        }
        $aff_by_method = array();
        if (isset($config['method'])) {
            for ($i = 0; $i < count($config['method']); $i++) {
                // In proto3, if the value is default, eg 0 for int, it won't be serialized.
                // Thus serialized string may not have `command` if the value is default 0(BOUND).
                if (!array_key_exists('command', $config['method'][$i]['affinity'])) {
                    $config['method'][$i]['affinity']['command'] = 'BOUND';
                }
                $aff_by_method[$config['method'][$i]['name'][0]] = $config['method'][$i]['affinity'];
            }
        }
        $affinity_conf['affinity_by_method'] = $aff_by_method;
        return $affinity_conf;
    }