AbstractRequestHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 2
c 2
b 0
f 0
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A supportsApplication() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\RequestHandler;
6
7
use MaxBeckers\AmazonAlexa\Request\Request;
8
use MaxBeckers\AmazonAlexa\Response\Response;
9
10
abstract class AbstractRequestHandler
11
{
12
    /**
13
     * @param string[] $supportedApplicationIds Array of supported application IDs
14
     */
15 14
    public function __construct(
16
        protected array $supportedApplicationIds = [],
17
    ) {
18 14
    }
19
20 2
    public function supportsApplication(Request $request): bool
21
    {
22 2
        return in_array($request->getApplicationId(), $this->supportedApplicationIds, true);
23
    }
24
25
    abstract public function supportsRequest(Request $request): bool;
26
27
    abstract public function handleRequest(Request $request): ?Response;
28
}
29