action = $action; $this->authentication_input = $authentication_input; } /** * @return WP_User|WP_Error|null */ public function run() { $this->request = new Regular_Request(); $this->request->fill_with_context( $this->request_context ); $result = $this->action->handle( $this ); return $result->feed_consumer( $this ); } /** * @param $user_id * * @return WP_User */ public function consume_user( $user_id ) { return new WP_User( $user_id ); } /** * @param $html */ public function consume_html( $html ) { echo $html; exit(); } /** * @param $error * * @return mixed * @throws Exception */ public function consume_error( $error ) { if ( ! ( $error instanceof WP_Error ) ) { throw new TwoFASLight_Exception( 'Unexpected response type from request handler' ); } return $error; } /** * @return WP_User|WP_Error|null */ public function consume_request_not_handled() { return $this->authentication_input->get(); } }