Auth_OpenID_PredisStore::getAssociation PHP Method

getAssociation() public method

Read association from Redis. If no handle given and multiple associations found, returns latest issued
public getAssociation ( $server_url, $handle = null )
    function getAssociation($server_url, $handle = null)
    {
        // simple case: handle given
        if ($handle !== null) {
            return $this->getAssociationFromServer($this->associationKey($server_url, $handle));
        }
        // no handle given, receiving the latest issued
        $serverKey = $this->associationServerKey($server_url);
        $lastKey = $this->redis->lindex($serverKey, -1);
        if (!$lastKey) {
            // no previous association with this server
            return null;
        }
        // get association, return null if failed
        return $this->getAssociationFromServer($lastKey);
    }