| Total Complexity | 8 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| 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 | 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 |
||
| 43 | } |
||
| 44 | |||
| 45 | public function getApiKey(): string |
||
| 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 |
||
| 63 | } |
||
| 64 | } |
||
| 65 |