From 0470ef5cd84c438fdaa8cc239c5c133a784b20a7 Mon Sep 17 00:00:00 2001 From: Vlad Shashkov Date: Mon, 15 Jun 2026 18:38:42 +0300 Subject: [PATCH 1/4] Added const for source --- src/RestClientBuilder.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/RestClientBuilder.php b/src/RestClientBuilder.php index e80edb8..c59bac4 100644 --- a/src/RestClientBuilder.php +++ b/src/RestClientBuilder.php @@ -56,6 +56,11 @@ final class RestClientBuilder { + public const SUGGEST_ADDRESSES_CLIENT = 'SUGGEST-ADDRESSES-CLIENT'; + public const SUGGEST_ORGANIZATION_CLIENT = 'SUGGEST-ORGANIZATION-CLIENT'; + public const CLEAN_ADDRESSES_CLIENT = 'CLEAN-ADDRESSES-CLIENT'; + public const CLEAN_FULLNAME_CLIENT = 'CLEAN-FULLNAME-CLIENT'; + private PsrHttpClient $client; private Serializer $serializer; @@ -200,7 +205,7 @@ public function withClient(PsrHttpClient $client): self */ public function createCleanFullNameClient(string $url = 'https://cleaner.dadata.ru'): CleanFullNameClient { - $new = $this->withSource('CLEAN-FULLNAME-CLIENT'); + $new = $this->withSource(self::CLEAN_FULLNAME_CLIENT); return new RestCleanFullNameClient( $new->serializer, @@ -216,7 +221,7 @@ public function createCleanFullNameClient(string $url = 'https://cleaner.dadata. */ public function createSuggestAddressClient(string $url = 'https://suggestions.dadata.ru'): SuggestAddressClient { - $new = $this->withSource('SUGGEST-ADDRESSES-CLIENT'); + $new = $this->withSource(self::SUGGEST_ADDRESSES_CLIENT); return new RestSuggestAddressClient( $new->serializer, @@ -232,7 +237,7 @@ public function createSuggestAddressClient(string $url = 'https://suggestions.da */ public function createSuggestOrganizationClient(string $url = 'https://suggestions.dadata.ru'): SuggestOrganizationClient { - $new = $this->withSource('SUGGEST-ORGANIZATION-CLIENT'); + $new = $this->withSource(self::SUGGEST_ORGANIZATION_CLIENT); return new RestSuggestOrganizationClient( $new->serializer, @@ -248,7 +253,7 @@ public function createSuggestOrganizationClient(string $url = 'https://suggestio */ public function createSuggestFullNameClient(string $url = 'https://suggestions.dadata.ru'): RestSuggestFullNameClient { - $new = $this->withSource('SUGGEST-FULLNAME-CLIENT'); + $new = $this->withSource(self::CLEAN_ADDRESSES_CLIENT); return new RestSuggestFullNameClient( $new->serializer, From da1d2d153b12051784438fbb7f74df132cdb075f Mon Sep 17 00:00:00 2001 From: Vlad Shashkov Date: Mon, 15 Jun 2026 18:40:20 +0300 Subject: [PATCH 2/4] Added const for source --- src/RestClientBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RestClientBuilder.php b/src/RestClientBuilder.php index c59bac4..0fc61c3 100644 --- a/src/RestClientBuilder.php +++ b/src/RestClientBuilder.php @@ -269,7 +269,7 @@ public function createSuggestFullNameClient(string $url = 'https://suggestions.d */ public function createCleanAddressClient(string $url = 'https://cleaner.dadata.ru'): CleanAddressClient { - $new = $this->withSource('CLEAN-ADDRESSES-CLIENT'); + $new = $this->withSource(self::CLEAN_ADDRESSES_CLIENT); return new RestCleanAddressClient( $new->serializer, From a5efcac60779333a41115cff00d51d21f105409f Mon Sep 17 00:00:00 2001 From: Vlad Shashkov Date: Mon, 15 Jun 2026 18:41:54 +0300 Subject: [PATCH 3/4] Added const for source --- src/RestClientBuilder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/RestClientBuilder.php b/src/RestClientBuilder.php index 0fc61c3..d9a2698 100644 --- a/src/RestClientBuilder.php +++ b/src/RestClientBuilder.php @@ -58,6 +58,7 @@ final class RestClientBuilder { public const SUGGEST_ADDRESSES_CLIENT = 'SUGGEST-ADDRESSES-CLIENT'; public const SUGGEST_ORGANIZATION_CLIENT = 'SUGGEST-ORGANIZATION-CLIENT'; + public const SUGGEST_FULLNAME_CLIENT = 'SUGGEST-FULLNAME-CLIENT'; public const CLEAN_ADDRESSES_CLIENT = 'CLEAN-ADDRESSES-CLIENT'; public const CLEAN_FULLNAME_CLIENT = 'CLEAN-FULLNAME-CLIENT'; @@ -253,7 +254,7 @@ public function createSuggestOrganizationClient(string $url = 'https://suggestio */ public function createSuggestFullNameClient(string $url = 'https://suggestions.dadata.ru'): RestSuggestFullNameClient { - $new = $this->withSource(self::CLEAN_ADDRESSES_CLIENT); + $new = $this->withSource(self::SUGGEST_FULLNAME_CLIENT); return new RestSuggestFullNameClient( $new->serializer, From c580cd5fd7893b033d6de87d1cde46128bd83b28 Mon Sep 17 00:00:00 2001 From: Vlad Shashkov Date: Mon, 15 Jun 2026 19:01:02 +0300 Subject: [PATCH 4/4] Added const for source --- src/RestClientBuilder.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/RestClientBuilder.php b/src/RestClientBuilder.php index d9a2698..68546c3 100644 --- a/src/RestClientBuilder.php +++ b/src/RestClientBuilder.php @@ -220,11 +220,11 @@ public function createCleanFullNameClient(string $url = 'https://cleaner.dadata. /** * @param non-empty-string $url */ - public function createSuggestAddressClient(string $url = 'https://suggestions.dadata.ru'): SuggestAddressClient + public function createSuggestFullNameClient(string $url = 'https://suggestions.dadata.ru'): RestSuggestFullNameClient { - $new = $this->withSource(self::SUGGEST_ADDRESSES_CLIENT); + $new = $this->withSource(self::SUGGEST_FULLNAME_CLIENT); - return new RestSuggestAddressClient( + return new RestSuggestFullNameClient( $new->serializer, new HttpClient( new ConfigurationClient($new->apiKey, $new->secretKey, $url), @@ -236,11 +236,11 @@ public function createSuggestAddressClient(string $url = 'https://suggestions.da /** * @param non-empty-string $url */ - public function createSuggestOrganizationClient(string $url = 'https://suggestions.dadata.ru'): SuggestOrganizationClient + public function createSuggestAddressClient(string $url = 'https://suggestions.dadata.ru'): SuggestAddressClient { - $new = $this->withSource(self::SUGGEST_ORGANIZATION_CLIENT); + $new = $this->withSource(self::SUGGEST_ADDRESSES_CLIENT); - return new RestSuggestOrganizationClient( + return new RestSuggestAddressClient( $new->serializer, new HttpClient( new ConfigurationClient($new->apiKey, $new->secretKey, $url), @@ -252,11 +252,11 @@ public function createSuggestOrganizationClient(string $url = 'https://suggestio /** * @param non-empty-string $url */ - public function createSuggestFullNameClient(string $url = 'https://suggestions.dadata.ru'): RestSuggestFullNameClient + public function createSuggestOrganizationClient(string $url = 'https://suggestions.dadata.ru'): SuggestOrganizationClient { - $new = $this->withSource(self::SUGGEST_FULLNAME_CLIENT); + $new = $this->withSource(self::SUGGEST_ORGANIZATION_CLIENT); - return new RestSuggestFullNameClient( + return new RestSuggestOrganizationClient( $new->serializer, new HttpClient( new ConfigurationClient($new->apiKey, $new->secretKey, $url),