Auth_OpenID_FileStore::_getAssociation PHP Method

_getAssociation() public method

public _getAssociation ( $filename )
    function _getAssociation($filename)
    {
        if (!$this->active) {
            trigger_error("FileStore no longer active", E_USER_ERROR);
            return null;
        }
        if (file_exists($filename) !== true) {
            return null;
        }
        $assoc_file = @fopen($filename, 'rb');
        if ($assoc_file === false) {
            return null;
        }
        $filesize = filesize($filename);
        if ($filesize === false || $filesize <= 0) {
            return null;
        }
        $assoc_s = fread($assoc_file, $filesize);
        fclose($assoc_file);
        if (!$assoc_s) {
            return null;
        }
        $association = Auth_OpenID_Association::deserialize('Auth_OpenID_Association', $assoc_s);
        if (!$association) {
            Auth_OpenID_FileStore::_removeIfPresent($filename);
            return null;
        }
        if ($association->getExpiresIn() == 0) {
            Auth_OpenID_FileStore::_removeIfPresent($filename);
            return null;
        } else {
            return $association;
        }
    }