MediaWiki  master
MediaWiki\Rest\RedirectException Class Reference

This is an exception class that extends HttpException and will generate a redirect when handled. More...

Inheritance diagram for MediaWiki\Rest\RedirectException:
Collaboration diagram for MediaWiki\Rest\RedirectException:

Public Member Functions

 __construct (int $code, string $target)
 
 getTarget ()
 
- Public Member Functions inherited from MediaWiki\Rest\HttpException
 __construct ( $message, $code=500, $errorData=null)
 
 getErrorData ()
 

Private Attributes

string $target
 The redirect target (an absolute URL) More...
 

Detailed Description

This is an exception class that extends HttpException and will generate a redirect when handled.

It is used when a redirect is treated as an exception output in your API, and you want to be able to throw it from wherever you are and immediately halt request processing.

@newable

Since
1.36

Definition at line 15 of file RedirectException.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\RedirectException::__construct ( int  $code,
string  $target 
)
Stability: stable
to call
Parameters
int$codeThe HTTP status code (3xx) for this redirect
string$targetThe redirect target (an absolute URL)

Definition at line 29 of file RedirectException.php.

References MediaWiki\Rest\RedirectException\$target.

Member Function Documentation

◆ getTarget()

MediaWiki\Rest\RedirectException::getTarget ( )
Returns
string

Definition at line 37 of file RedirectException.php.

References MediaWiki\Rest\RedirectException\$target.

Member Data Documentation

◆ $target

string MediaWiki\Rest\RedirectException::$target
private

The redirect target (an absolute URL)

Definition at line 21 of file RedirectException.php.

Referenced by MediaWiki\Rest\RedirectException\__construct(), and MediaWiki\Rest\RedirectException\getTarget().


The documentation for this class was generated from the following file: