Test Failed
Push — master ( 0cbd75...cf64e0 )
by Dmitry
02:49
created

Configuration::fromClientKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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
    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
        $this->apiKey = $clientKey;
24
        $this->apiUrl = $apiUrl;
25
        $this->languagePool = $languagePool;
26
        $this->callbackUrl = $callbackUrl;
27
        $this->softId = $softId;
28
    }
29
30
    public static function fromClientKey(string $clientKey): self
31
    {
32
        return new self($clientKey);
33
    }
34
35
    public function getClientKey(): string
36
    {
37
        return $this->apiKey;
38
    }
39
40
    public function getApiUrl(): string
41
    {
42
        return $this->apiUrl;
43
    }
44
45
    public function getApiKey(): string
46
    {
47
        return $this->apiKey;
48
    }
49
50
    public function getLanguagePool(): ?string
51
    {
52
        return $this->languagePool;
53
    }
54
55
    public function getCallbackUrl(): ?string
56
    {
57
        return $this->callbackUrl;
58
    }
59
60
    public function getSoftId(): ?int
61
    {
62
        return $this->softId;
63
    }
64
}
65