Passed
Pull Request — master (#97)
by Maximilian
03:49
created

AbstractRequestHandler::supportsApplication()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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