public function hasValidData(\Psr\Http\Message\ServerRequestInterface $request, $key = null)
    {
        if (! in_array($request->getMethod(), ['POST', 'PATCH', 'PUT', 'DELETE'])) {
            return false;
        }
        if (! $this->check($request)) {
            return false;
        }
        $data = $request->getParsedBody();
        return ! isset($key) or isset($data[$key]);
    }