Skip to content

Commit 979cc19

Browse files
authored
Merge pull request #53 from JerrySmidt/3.1.6.1
Bug #41: Fix inconsistent method names
2 parents c381a0b + 6473105 commit 979cc19

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Helper/ApiClientHelper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function formatSupportedCountriesJs($countries=[])
106106
*/
107107
private function _prepareApiClient(): PostcodeApiClient
108108
{
109-
$isApiReady = $this->isPostCodeApiReady();
109+
$isApiReady = $this->_isPostCodeApiReady();
110110
if ($isApiReady !== true) {
111111
return $isApiReady;
112112
}
@@ -139,7 +139,7 @@ public function getAddressAutocomplete(string $context, string $term): array
139139

140140
$sessionStr = $this->request->getHeader($client::SESSION_HEADER_KEY);
141141
if (empty($sessionStr)) {
142-
$sessionStr = $this->generateSessionString();
142+
$sessionStr = $this->_generateSessionString();
143143
}
144144

145145
$response = $client->internationalAutocomplete($context, $term, $sessionStr, $locale);
@@ -172,7 +172,7 @@ public function getAddressDetails(string $context, string $dispatchCountry = '')
172172

173173
$sessionStr = $this->request->getHeader($client::SESSION_HEADER_KEY);
174174
if (empty($sessionStr)) {
175-
$sessionStr = $this->generateSessionString();
175+
$sessionStr = $this->_generateSessionString();
176176
}
177177

178178
$response = $client->internationalGetDetails($context, $sessionStr);
@@ -397,12 +397,12 @@ private function _getSecret(): string
397397

398398

399399
/**
400-
* isPostCodeApiReady function.
400+
* _isPostCodeApiReady function.
401401
*
402402
* @access private
403403
* @return bool|array
404404
*/
405-
private function isPostCodeApiReady()
405+
private function _isPostCodeApiReady()
406406
{
407407
if (empty($this->getStoreConfig('postcodenl_api/general/enabled'))) {
408408
return ['message' => __('Postcode.eu API not enabled.')];

Helper/PostcodeApiClient.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,23 @@ public function __construct(string $key, string $secret)
7575
*/
7676
public function internationalAutocomplete(string $context, string $term, ?string $session = null, $language=""): array
7777
{
78-
return $this->performApiCall('international/v1/autocomplete/' . rawurlencode($context) . '/' . rawurlencode($term) . '/' . rawurlencode($language), $session ?? $this->generateSessionString());
78+
return $this->_performApiCall('international/v1/autocomplete/' . rawurlencode($context) . '/' . rawurlencode($term) . '/' . rawurlencode($language), $session ?? $this->_generateSessionString());
7979
}
8080

8181
/**
8282
* @see https://api.postcode.nl/documentation/international/v1/Autocomplete/getDetails
8383
*/
8484
public function internationalGetDetails(string $context, ?string $session = null): array
8585
{
86-
return $this->performApiCall('international/v1/address/' . rawurlencode($context), $session ?? $this->generateSessionString());
86+
return $this->_performApiCall('international/v1/address/' . rawurlencode($context), $session ?? $this->_generateSessionString());
8787
}
8888

8989
/**
9090
* @see https://api.postcode.nl/documentation/international/v1/Autocomplete/getSupportedCountries
9191
*/
9292
public function internationalGetSupportedCountries(): array
9393
{
94-
return $this->performApiCall('international/v1/supported-countries', null);
94+
return $this->_performApiCall('international/v1/supported-countries', null);
9595
}
9696

9797
/**
@@ -123,12 +123,12 @@ public function dutchAddressByPostcode(string $postcode, int $houseNumber, ?stri
123123
{
124124
$urlParts[] = rawurlencode($houseNumberAddition);
125125
}
126-
return $this->performApiCall(implode('/', $urlParts), null);
126+
return $this->_performApiCall(implode('/', $urlParts), null);
127127
}
128128

129129
public function accountInfo(): array
130130
{
131-
return $this->performApiCall('account/v1/info', null);
131+
return $this->_performApiCall('account/v1/info', null);
132132
}
133133

134134
/**
@@ -155,12 +155,12 @@ public function __destruct()
155155
curl_close($this->_curlHandler);
156156
}
157157

158-
protected function generateSessionString(): string
158+
protected function _generateSessionString(): string
159159
{
160160
return bin2hex(random_bytes(8));
161161
}
162162

163-
protected function performApiCall(string $path, ?string $session): array
163+
protected function _performApiCall(string $path, ?string $session): array
164164
{
165165
$url = static::SERVER_URL . $path;
166166
curl_setopt($this->_curlHandler, CURLOPT_URL, $url);

0 commit comments

Comments
 (0)