| Total Complexity | 8 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 90% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 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 |
|
| 43 | } |
||
| 44 | |||
| 45 | public function getApiKey(): string |
||
| 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 |
|
| 63 | } |
||
| 64 | } |
||
| 65 |