/** * Call * * If method exists on self::$response pass to that, otherwise * throw BadMethodCallException * * @param string $method Name of the method * @param array $args Arguments for the method * * @return mixed Result from method * @throws BadMethodCallException When method does not exist on * self::$response */ public function __call($method, $args) { if (method_exists($this->response->getResponse(), $method) || method_exists($this->response, $method)) { return call_user_func_array(array($this->response, $method), $args); } throw new BadMethodCallException($method); }
/** * @expectedException BadMethodCallException */ public function testBadMethodCall() { $res = new HTTP_OAuth_Consumer_Response(new HTTP_Request2_Response('HTTP/1.1 200 OK')); $res->foo(); }