Configuration   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Test Coverage

Coverage 90%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 8
eloc 20
c 2
b 0
f 0
dl 0
loc 58
ccs 18
cts 20
cp 0.9
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getApiUrl() 0 3 1
A getApiKey() 0 3 1
A getSoftId() 0 3 1
A getCallbackUrl() 0 3 1
A fromClientKey() 0 3 1
A getClientKey() 0 3 1
A getLanguagePool() 0 3 1
A __construct() 0 12 1
1
<?php
2
3
namespace Anticaptcha;
4
5
final class Configuration implements ConfigurationInterface
6
{
7
    public const DEFAULT_API_URL = 'https://api.anti-captcha.com';
8
    public const DEFAULT_SOFT_ID = 857;  // ID of this library
9
10
    private string $apiKey;
11
    private string $apiUrl;
12
    private ?string $languagePool;
13
    private ?string $callbackUrl;
14
    private ?int $softId;
15
16 2
    public function __construct(
17
        string $clientKey,
18
        string $apiUrl = self::DEFAULT_API_URL,
19
        ?string $languagePool = null,
20
        ?string $callbackUrl = null,
21
        ?int $softId = self::DEFAULT_SOFT_ID
22
    ) {
23 2
        $this->apiKey = $clientKey;
24 2
        $this->apiUrl = $apiUrl;
25 2
        $this->languagePool = $languagePool;
26 2
        $this->callbackUrl = $callbackUrl;
27 2
        $this->softId = $softId;
28
    }
29
30 1
    public static function fromClientKey(string $clientKey): self
31
    {
32 1
        return new self($clientKey);
33
    }
34
35 2
    public function getClientKey(): string
36
    {
37 2
        return $this->apiKey;
38
    }
39
40 2
    public function getApiUrl(): string
41
    {
42 2
        return $this->apiUrl;
43
    }
44
45
    public function getApiKey(): string
46
    {
47
        return $this->apiKey;
48
    }
49
50 2
    public function getLanguagePool(): ?string
51
    {
52 2
        return $this->languagePool;
53
    }
54
55 2
    public function getCallbackUrl(): ?string
56
    {
57 2
        return $this->callbackUrl;
58
    }
59
60 2
    public function getSoftId(): ?int
61
    {
62 2
        return $this->softId;
63
    }
64
}
65