Completed
Pull Request — develop (#745)
by Alejandro
05:29
created

AbstractRestAction   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 7
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRouteDef() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\Rest\Action;
6
7
use Fig\Http\Message\RequestMethodInterface;
8
use Fig\Http\Message\StatusCodeInterface;
9
use Psr\Http\Server\RequestHandlerInterface;
10
11
use function array_merge;
12
13
abstract class AbstractRestAction implements RequestHandlerInterface, RequestMethodInterface, StatusCodeInterface
14
{
15
    protected const ROUTE_PATH = '';
16
    protected const ROUTE_ALLOWED_METHODS = [];
17
18 1
    public static function getRouteDef(array $prevMiddleware = [], array $postMiddleware = []): array
19
    {
20
        return [
21 1
            'name' => static::class,
22 1
            'middleware' => array_merge($prevMiddleware, [static::class], $postMiddleware),
23 1
            'path' => static::ROUTE_PATH,
24 1
            'allowed_methods' => static::ROUTE_ALLOWED_METHODS,
25
        ];
26
    }
27
}
28