Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 2 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| StaticBasicAuthorizer | |
0.00% |
0 / 2 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| authorize | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Rest\BasicAccess; |
| 4 | |
| 5 | use MediaWiki\Rest\Handler; |
| 6 | use MediaWiki\Rest\RequestInterface; |
| 7 | |
| 8 | /** |
| 9 | * An authorizer which returns a value from authorize() which is given in the constructor. |
| 10 | * |
| 11 | * @internal |
| 12 | */ |
| 13 | class StaticBasicAuthorizer implements BasicAuthorizerInterface { |
| 14 | /** @var string|null */ |
| 15 | private $value; |
| 16 | |
| 17 | /** |
| 18 | * @see BasicAuthorizerInterface::authorize() |
| 19 | * |
| 20 | * @param string|null $value The value returned by authorize(). If the |
| 21 | * request is denied, this is the string error code. If the request is |
| 22 | * allowed, it is null. |
| 23 | */ |
| 24 | public function __construct( $value = null ) { |
| 25 | $this->value = $value; |
| 26 | } |
| 27 | |
| 28 | /** @inheritDoc */ |
| 29 | public function authorize( RequestInterface $request, Handler $handler ) { |
| 30 | return $this->value; |
| 31 | } |
| 32 | } |