Configuration::getClientKey()   A
last analyzed

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