yii\authclient\OpenId::buildSregParams PHP Method

buildSregParams() protected method

Composes SREG request parameters.
protected buildSregParams ( ) : array
return array SREG parameters.
    protected function buildSregParams()
    {
        $params = [];
        /* We always use SREG 1.1, even if the server is advertising only support for 1.0.
           That's because it's fully backwards compatible with 1.0, and some providers
           advertise 1.0 even if they accept only 1.1. One such provider is myopenid.com */
        $params['openid.ns.sreg'] = 'http://openid.net/extensions/sreg/1.1';
        if (!empty($this->requiredAttributes)) {
            $params['openid.sreg.required'] = [];
            foreach ($this->requiredAttributes as $required) {
                if (!isset($this->axToSregMap[$required])) {
                    continue;
                }
                $params['openid.sreg.required'][] = $this->axToSregMap[$required];
            }
            $params['openid.sreg.required'] = implode(',', $params['openid.sreg.required']);
        }
        if (!empty($this->optionalAttributes)) {
            $params['openid.sreg.optional'] = [];
            foreach ($this->optionalAttributes as $optional) {
                if (!isset($this->axToSregMap[$optional])) {
                    continue;
                }
                $params['openid.sreg.optional'][] = $this->axToSregMap[$optional];
            }
            $params['openid.sreg.optional'] = implode(',', $params['openid.sreg.optional']);
        }
        return $params;
    }