mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-20 01:09:56 +03:00
Added public method in AbstractRestAction which builds route definition
This commit is contained in:
parent
4fee656f96
commit
c9ce56eea5
1 changed files with 13 additions and 0 deletions
|
@ -11,6 +11,9 @@ use Psr\Log\NullLogger;
|
||||||
|
|
||||||
abstract class AbstractRestAction implements RequestHandlerInterface, RequestMethodInterface, StatusCodeInterface
|
abstract class AbstractRestAction implements RequestHandlerInterface, RequestMethodInterface, StatusCodeInterface
|
||||||
{
|
{
|
||||||
|
protected const ROUTE_PATH = '';
|
||||||
|
protected const ALLOWED_METHODS = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var LoggerInterface
|
* @var LoggerInterface
|
||||||
*/
|
*/
|
||||||
|
@ -20,4 +23,14 @@ abstract class AbstractRestAction implements RequestHandlerInterface, RequestMet
|
||||||
{
|
{
|
||||||
$this->logger = $logger ?: new NullLogger();
|
$this->logger = $logger ?: new NullLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getRouteDef(array $prevMiddleware = [], array $postMiddleware = []): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => static::class,
|
||||||
|
'middleware' => \array_merge($prevMiddleware, [static::class], $postMiddleware),
|
||||||
|
'path' => static::ROUTE_PATH,
|
||||||
|
'allowed_methods' => static::ALLOWED_METHODS,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue