Testing   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 20
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Werkspot\KvkApi\Http\Endpoint;
6
7
use Exception;
8
use Werkspot\KvkApi\Http\Endpoint\Exception\EndpointCouldNotBeMappedException;
9
10
final class Testing implements MapperInterface
11
{
12
    public const BASE_URL = 'https://api.kvk.nl';
13
    private const SEARCH_ENDPOINT = '/api/v2/testsearch/companies';
14
    private const PROFILE_ENDPOINT = '/api/v2/testprofile/companies';
15
16
    private $map = [
17
        MapperInterface::SEARCH => self::BASE_URL . self::SEARCH_ENDPOINT,
18
        MapperInterface::PROFILE => self::BASE_URL . self::PROFILE_ENDPOINT,
19
    ];
20
21 37
    public function map(string $key): string
22
    {
23
        try {
24 37
            return $this->map[$key];
25 1
        } catch (Exception $exception) {
26 1
            throw new EndpointCouldNotBeMappedException(sprintf('key \'%s\' could not be mapped to an URL', $key));
27
        }
28
    }
29
}
30