Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| HookRunner | |
0.00% |
0 / 10 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onRestCheckCanExecute | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| onRestAfterExecute | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Rest\Hook; |
| 4 | |
| 5 | use MediaWiki\HookContainer\HookContainer; |
| 6 | use MediaWiki\Rest\Handler; |
| 7 | use MediaWiki\Rest\HttpException; |
| 8 | use MediaWiki\Rest\Module\Module; |
| 9 | use MediaWiki\Rest\RequestInterface; |
| 10 | use MediaWiki\Rest\ResponseInterface; |
| 11 | |
| 12 | class HookRunner implements |
| 13 | RestAfterExecuteHook, |
| 14 | RestCheckCanExecuteHook |
| 15 | { |
| 16 | |
| 17 | public function __construct( |
| 18 | private readonly HookContainer $container, |
| 19 | ) { |
| 20 | } |
| 21 | |
| 22 | public function onRestCheckCanExecute( |
| 23 | Module $module, |
| 24 | Handler $handler, |
| 25 | string $path, |
| 26 | RequestInterface $request, |
| 27 | ?HttpException &$error |
| 28 | ): bool { |
| 29 | return $this->container->run( |
| 30 | 'RestCheckCanExecute', |
| 31 | [ $module, $handler, $path, $request, &$error ] |
| 32 | ); |
| 33 | } |
| 34 | |
| 35 | public function onRestAfterExecute( |
| 36 | Module $module, |
| 37 | ?Handler $handler, |
| 38 | string $path, |
| 39 | RequestInterface $request, |
| 40 | ResponseInterface $response |
| 41 | ): void { |
| 42 | $this->container->run( |
| 43 | 'RestAfterExecute', |
| 44 | [ $module, $handler, $path, $request, $response ], |
| 45 | [ 'abortable' => false ] |
| 46 | ); |
| 47 | } |
| 48 | |
| 49 | } |