Completed
Push — develop ( 449838...84b38c )
by Alejandro
16s queued 12s
created

AbstractRestAction::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 2
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