wiki.techinc.nl/includes/Rest/BasicAccess/StaticBasicAuthorizer.php
Umherirrender 503bff0b04 Rest: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: Idf17719c875466810313f0fbbf16bc67f3e40059
2024-09-07 21:49:56 +02:00

31 lines
751 B
PHP

<?php
namespace MediaWiki\Rest\BasicAccess;
use MediaWiki\Rest\Handler;
use MediaWiki\Rest\RequestInterface;
/**
* An authorizer which returns a value from authorize() which is given in the constructor.
*
* @internal
*/
class StaticBasicAuthorizer implements BasicAuthorizerInterface {
/** @var string|null */
private $value;
/**
* @see BasicAuthorizerInterface::authorize()
*
* @param string|null $value The value returned by authorize(). If the
* request is denied, this is the string error code. If the request is
* allowed, it is null.
*/
public function __construct( $value = null ) {
$this->value = $value;
}
public function authorize( RequestInterface $request, Handler $handler ) {
return $this->value;
}
}