Passed
Pull Request — master (#97)
by Maximilian
04:02
created

AbstractRequestHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
    public function __construct(
16
        protected array $supportedApplicationIds = [],
17
    ) {
18
    }
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