Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
85.71% |
6 / 7 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ThrottledError | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| report | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @license GPL-2.0-or-later |
| 4 | * @file |
| 5 | */ |
| 6 | |
| 7 | namespace MediaWiki\Exception; |
| 8 | |
| 9 | /** |
| 10 | * Show an error when the user hits a rate limit. |
| 11 | * |
| 12 | * @newable |
| 13 | * @since 1.18 |
| 14 | * @ingroup Exception |
| 15 | */ |
| 16 | class ThrottledError extends ErrorPageError { |
| 17 | |
| 18 | /** |
| 19 | * @stable to call |
| 20 | */ |
| 21 | public function __construct() { |
| 22 | parent::__construct( |
| 23 | 'actionthrottled', |
| 24 | 'actionthrottledtext' |
| 25 | ); |
| 26 | } |
| 27 | |
| 28 | /** @inheritDoc */ |
| 29 | public function report( $action = ErrorPageError::SEND_OUTPUT ) { |
| 30 | global $wgOut; |
| 31 | $wgOut->setStatusCode( 429 ); |
| 32 | parent::report( $action ); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | /** @deprecated class alias since 1.44 */ |
| 37 | class_alias( ThrottledError::class, 'ThrottledError' ); |