protected function buildAxParams()
    {
        $params = [];
        if (!empty($this->requiredAttributes) || !empty($this->optionalAttributes)) {
            $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
            $params['openid.ax.mode'] = 'fetch_request';
            $aliases = [];
            $counts = [];
            $requiredAttributes = [];
            $optionalAttributes = [];
            foreach (['requiredAttributes', 'optionalAttributes'] as $type) {
                foreach ($this->$type as $alias => $field) {
                    if (is_int($alias)) {
                        $alias = strtr($field, '/', '_');
                    }
                    $aliases[$alias] = 'http://axschema.org/' . $field;
                    if (empty($counts[$alias])) {
                        $counts[$alias] = 0;
                    }
                    $counts[$alias] += 1;
                    ${$type}[] = $alias;
                }
            }
            foreach ($aliases as $alias => $ns) {
                $params['openid.ax.type.' . $alias] = $ns;
            }
            foreach ($counts as $alias => $count) {
                if ($count == 1) {
                    continue;
                }
                $params['openid.ax.count.' . $alias] = $count;
            }

            // Don't send empty ax.required and ax.if_available.
            // Google and possibly other providers refuse to support ax when one of these is empty.
            if (!empty($requiredAttributes)) {
                $params['openid.ax.required'] = implode(',', $requiredAttributes);
            }
            if (!empty($optionalAttributes)) {
                $params['openid.ax.if_available'] = implode(',', $optionalAttributes);
            }
        }

        return $params;
    }
protected function buildAxParams()
    {
        $params = [];
        if (!empty($this->requiredAttributes) || !empty($this->optionalAttributes)) {
            $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
            $params['openid.ax.mode'] = 'fetch_request';
            $aliases = [];
            $counts = [];
            $requiredAttributes = [];
            $optionalAttributes = [];
            foreach (['requiredAttributes', 'optionalAttributes'] as $type) {
                foreach ($this->$type as $alias => $field) {
                    if (is_int($alias)) {
                        $alias = strtr($field, '/', '_');
                    }
                    $aliases[$alias] = 'http://axschema.org/' . $field;
                    if (empty($counts[$alias])) {
                        $counts[$alias] = 0;
                    }
                    $counts[$alias] += 1;
                    ${$type}[] = $alias;
                }
            }
            foreach ($aliases as $alias => $ns) {
                $params['openid.ax.type.' . $alias] = $ns;
            }
            foreach ($counts as $alias => $count) {
                if ($count == 1) {
                    continue;
                }
                $params['openid.ax.count.' . $alias] = $count;
            }

            // Don't send empty ax.required and ax.if_available.
            // Google and possibly other providers refuse to support ax when one of these is empty.
            if (!empty($requiredAttributes)) {
                $params['openid.ax.required'] = implode(',', $requiredAttributes);
            }
            if (!empty($optionalAttributes)) {
                $params['openid.ax.if_available'] = implode(',', $optionalAttributes);
            }
        }

        return $params;
    }
protected function buildAxParams ( ) { $ params = [ ] ; if ( ! empty ( $ this -> requiredAttributes ) || ! empty ( $ this -> optionalAttributes ) ) { $ params [ 'openid.ns.ax' ] = 'http://openid.net/srv/ax/1.0' ; $ params [ 'openid.ax.mode' ] = 'fetch_request' ; $ aliases = [ ] ; $ counts = [ ] ; $ requiredAttributes = [ ] ; $ optionalAttributes = [ ] ; foreach ( [ 'requiredAttributes' , 'optionalAttributes' ] as $ type ) { foreach ( $ this -> $ type as $ alias => $ field ) { if ( is_int ( $ alias ) ) { $ alias = strtr ( $ field , '/' , '_' ) ; } $ aliases [ $ alias ] = 'http://axschema.org/' . $ field ; if ( empty ( $ counts [ $ alias ] ) ) { $ counts [ $ alias ] = 0 ; } $ counts [ $ alias ] += 1 ; $ { $ type } [ ] = $ alias ; } } foreach ( $ aliases as $ alias => $ ns ) { $ params [ 'openid.ax.type.' . $ alias ] = $ ns ; } foreach ( $ counts as $ alias => $ count ) { if ( $ count == 1 ) { continue ; } $ params [ 'openid.ax.count.' . $ alias ] = $ count ; } // Don't send empty ax.required and ax.if_available. // Google and possibly other providers refuse to support ax when one of these is empty. if ( ! empty ( $ requiredAttributes ) ) { $ params [ 'openid.ax.required' ] = implode ( ',' , $ requiredAttributes ) ; } if ( ! empty ( $ optionalAttributes ) ) { $ params [ 'openid.ax.if_available' ] = implode ( ',' , $ optionalAttributes ) ; } } return $ params ; }
Composes AX request parameters.
@return array AX parameters.
Composes AX request parameters .