变更
This commit is contained in:
@@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Kiri\Router\Constrict;
|
namespace Kiri\Router\Constrict;
|
||||||
|
|
||||||
|
use Kiri\Router\Base\AuthorizationInterface;
|
||||||
use Psr\Http\Message\RequestInterface;
|
use Psr\Http\Message\RequestInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Message\UriInterface;
|
use Psr\Http\Message\UriInterface;
|
||||||
@@ -33,6 +34,31 @@ class ConstrictRequest extends Message implements RequestInterface, ServerReques
|
|||||||
private array $serverParams = [];
|
private array $serverParams = [];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var AuthorizationInterface|null
|
||||||
|
*/
|
||||||
|
private ?AuthorizationInterface $authorization = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return AuthorizationInterface|null
|
||||||
|
*/
|
||||||
|
public function getAuthority(): ?AuthorizationInterface
|
||||||
|
{
|
||||||
|
return $this->authorization;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param AuthorizationInterface $authorization
|
||||||
|
* @return RequestInterface
|
||||||
|
*/
|
||||||
|
public function withAuthority(AuthorizationInterface $authorization): RequestInterface
|
||||||
|
{
|
||||||
|
$this->authorization = $authorization;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
namespace Kiri\Router;
|
namespace Kiri\Router;
|
||||||
|
|
||||||
use Kiri\Di\Context;
|
use Kiri\Di\Context;
|
||||||
|
use Kiri\Router\Base\AuthorizationInterface;
|
||||||
use Kiri\Router\Base\ExceptionHandlerDispatcher;
|
use Kiri\Router\Base\ExceptionHandlerDispatcher;
|
||||||
use Psr\Http\Message\RequestInterface;
|
use Psr\Http\Message\RequestInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
@@ -13,6 +14,7 @@ use Psr\Http\Message\UriInterface;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @property-read bool $isPost
|
* @property-read bool $isPost
|
||||||
|
* @property-read AuthorizationInterface $authority
|
||||||
*/
|
*/
|
||||||
class Request implements ServerRequestInterface
|
class Request implements ServerRequestInterface
|
||||||
{
|
{
|
||||||
@@ -27,6 +29,25 @@ class Request implements ServerRequestInterface
|
|||||||
public string $exception = ExceptionHandlerDispatcher::class;
|
public string $exception = ExceptionHandlerDispatcher::class;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return AuthorizationInterface|null
|
||||||
|
*/
|
||||||
|
public function getAuthority(): ?AuthorizationInterface
|
||||||
|
{
|
||||||
|
return $this->__call__(__FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param AuthorizationInterface $authorization
|
||||||
|
* @return RequestInterface
|
||||||
|
*/
|
||||||
|
public function withAuthority(AuthorizationInterface $authorization): RequestInterface
|
||||||
|
{
|
||||||
|
return $this->__call__(__FUNCTION__, $authorization);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param mixed ...$params
|
* @param mixed ...$params
|
||||||
|
|||||||
Reference in New Issue
Block a user