/** * Try to find the consumer for the provided request's consumer key. * * @param JacobKiers\OAuth\Request\RequestInterface $request * * @return JacobKiers\OAuth\Consumer\ConsumerInterface * * @throws JacobKiers\OAuth\OAuthException */ private function getConsumer(RequestInterface $request) { $consumer_key = $request instanceof RequestInterface ? $request->getOAuthConsumerKey() : null; if (!$consumer_key) { throw new OAuthException('Invalid consumer key'); } $consumer = $this->data_store->lookupConsumer($consumer_key); if (!$consumer) { throw new OAuthException('Invalid consumer'); } return $consumer; }