fkooman\OAuth\Client\SessionStorage::deleteStateForContext PHP Method

deleteStateForContext() public method

public deleteStateForContext ( $clientConfigId, Context $context )
$context Context
    public function deleteStateForContext($clientConfigId, Context $context)
    {
        if (!isset($_SESSION['php-oauth-client']['state'])) {
            return false;
        }
        foreach ($_SESSION['php-oauth-client']['state'] as $k => $s) {
            $sessionState = unserialize($s);
            if ($clientConfigId !== $sessionState->getClientConfigId()) {
                continue;
            }
            if ($context->getUserId() !== $sessionState->getUserId()) {
                continue;
            }
            unset($_SESSION['php-oauth-client']['state'][$k]);
            return true;
        }
        return false;
    }