Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| InvalidActionException | |
0.00% |
0 / 12 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| getErrorCodeList | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| report | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Flow\Exception; |
| 4 | |
| 5 | use MediaWiki\Exception\ErrorPageError; |
| 6 | |
| 7 | /** |
| 8 | * Category: invalid action exception |
| 9 | */ |
| 10 | class InvalidActionException extends ErrorPageError { |
| 11 | |
| 12 | public function __construct( $message, $code = 'default' ) { |
| 13 | $list = $this->getErrorCodeList(); |
| 14 | if ( !in_array( $code, $list ) ) { |
| 15 | $code = 'default'; |
| 16 | } |
| 17 | parent::__construct( 'nosuchaction', "flow-error-$code" ); |
| 18 | } |
| 19 | |
| 20 | protected function getErrorCodeList() { |
| 21 | // Comments are i18n messages, for grepping |
| 22 | return [ |
| 23 | 'invalid-action', |
| 24 | // flow-error-invalid-action |
| 25 | ]; |
| 26 | } |
| 27 | |
| 28 | public function report( $action = ErrorPageError::SEND_OUTPUT ) { |
| 29 | global $wgOut; |
| 30 | $wgOut->setStatusCode( 400 ); |
| 31 | parent::report( $action ); |
| 32 | } |
| 33 | |
| 34 | } |