|
4 | 4 |
|
5 | 5 | namespace Bitrix24\SDK\Core; |
6 | 6 |
|
| 7 | +use Bitrix24\SDK\Core\Contracts\ApiClientInterface; |
7 | 8 | use Bitrix24\SDK\Core\Contracts\CoreInterface; |
8 | 9 | use Bitrix24\SDK\Core\Credentials\Credentials; |
9 | 10 | use Bitrix24\SDK\Core\Credentials\WebhookUrl; |
|
22 | 23 | */ |
23 | 24 | class CoreBuilder |
24 | 25 | { |
25 | | - /** |
26 | | - * @var ApiClient|null |
27 | | - */ |
28 | | - protected $apiClient; |
29 | | - /** |
30 | | - * @var HttpClientInterface |
31 | | - */ |
32 | | - protected $httpClient; |
33 | | - /** |
34 | | - * @var EventDispatcherInterface |
35 | | - */ |
36 | | - protected $eventDispatcher; |
37 | | - /** |
38 | | - * @var LoggerInterface |
39 | | - */ |
40 | | - protected $logger; |
41 | | - /** |
42 | | - * @var WebhookUrl|null |
43 | | - */ |
44 | | - protected $webhookUrl; |
45 | | - /** |
46 | | - * @var Credentials|null |
47 | | - */ |
48 | | - protected $credentials; |
49 | | - /** |
50 | | - * @var ApiLevelErrorHandler |
51 | | - */ |
52 | | - protected $apiLevelErrorHandler; |
| 26 | + protected ?ApiClientInterface $apiClient; |
| 27 | + protected HttpClientInterface $httpClient; |
| 28 | + protected EventDispatcherInterface $eventDispatcher; |
| 29 | + protected LoggerInterface $logger; |
| 30 | + protected ?WebhookUrl $webhookUrl; |
| 31 | + protected ?Credentials $credentials; |
| 32 | + protected ApiLevelErrorHandler $apiLevelErrorHandler; |
53 | 33 |
|
54 | 34 | /** |
55 | 35 | * CoreBuilder constructor. |
@@ -83,11 +63,11 @@ public function withWebhookUrl(string $webhookUrl): self |
83 | 63 | } |
84 | 64 |
|
85 | 65 | /** |
86 | | - * @param ApiClient $apiClient |
| 66 | + * @param ApiClientInterface $apiClient |
87 | 67 | * |
88 | 68 | * @return $this |
89 | 69 | */ |
90 | | - public function withApiClient(ApiClient $apiClient): self |
| 70 | + public function withApiClient(ApiClientInterface $apiClient): self |
91 | 71 | { |
92 | 72 | $this->apiClient = $apiClient; |
93 | 73 |
|
@@ -127,7 +107,7 @@ public function build(): CoreInterface |
127 | 107 | if ($this->webhookUrl !== null) { |
128 | 108 | $this->credentials = Credentials::createForWebHook($this->webhookUrl); |
129 | 109 | } elseif ($this->credentials === null) { |
130 | | - throw new InvalidArgumentException(sprintf('you must set webhook url or oauth credentials')); |
| 110 | + throw new InvalidArgumentException('you must set webhook url or oauth credentials'); |
131 | 111 | } |
132 | 112 |
|
133 | 113 | if ($this->apiClient === null) { |
|
0 commit comments