public function check($lock, $format = 'json', array $headers = [])
    {
        list($headers, $body) = $this->doCheck($lock, $format, $headers);

        if (!(preg_match('/X-Alerts: (\d+)/i', $headers, $matches) || 2 == \count($matches))) {
            throw new RuntimeException('The web service did not return alerts count.');
        }

        return new Result((int) $matches[1], $body, $format);
    }