public function getOffset(string $resourceClass = null, string $operationName = null, array $context = []): int
    {
        $graphql = $context['graphql'] ?? false;

        $limit = $this->getLimit($resourceClass, $operationName, $context);

        if ($graphql && null !== ($after = $this->getParameterFromContext($context, 'after'))) {
            return false === ($after = base64_decode($after, true)) ? 0 : (int) $after + 1;
        }

        if ($graphql && null !== ($before = $this->getParameterFromContext($context, 'before'))) {
            return ($offset = (false === ($before = base64_decode($before, true)) ? 0 : (int) $before - $limit)) < 0 ? 0 : $offset;
        }

        if ($graphql && null !== ($last = $this->getParameterFromContext($context, 'last'))) {
            return ($offset = ($context['count'] ?? 0) - $last) < 0 ? 0 : $offset;
        }

        return ($this->getPage($context) - 1) * $limit;
    }