Skip to content

Commit

Permalink
refactor(php): unify $hostSettings variable name (OpenAPITools#17828)
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Feb 12, 2024
1 parent f431540 commit ec42f88
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,23 +493,23 @@ class Configuration
/**
* Returns URL based on host settings, index and variables
*
* @param array $hostsSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostsSettings, int $hostIndex, array $variables = null): string
public static function getHostString(array $hostSettings, int $hostIndex, array $variables = null): string
{
if (null === $variables) {
$variables = [];
}

// check array index out of bound
if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) {
throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings));
}

$host = $hostsSettings[$hostIndex];
$host = $hostSettings[$hostIndex];
$url = $host["url"];

// go through variable and assign a value
Expand Down
10 changes: 5 additions & 5 deletions samples/client/echo_api/php-nextgen/src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,23 +477,23 @@ public function getHostSettings(): array
/**
* Returns URL based on host settings, index and variables
*
* @param array $hostsSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostsSettings, int $hostIndex, array $variables = null): string
public static function getHostString(array $hostSettings, int $hostIndex, array $variables = null): string
{
if (null === $variables) {
$variables = [];
}

// check array index out of bound
if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) {
throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings));
}

$host = $hostsSettings[$hostIndex];
$host = $hostSettings[$hostIndex];
$url = $host["url"];

// go through variable and assign a value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,23 +513,23 @@ public function getHostSettings(): array
/**
* Returns URL based on host settings, index and variables
*
* @param array $hostsSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostsSettings, int $hostIndex, array $variables = null): string
public static function getHostString(array $hostSettings, int $hostIndex, array $variables = null): string
{
if (null === $variables) {
$variables = [];
}

// check array index out of bound
if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) {
throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings));
}

$host = $hostsSettings[$hostIndex];
$host = $hostSettings[$hostIndex];
$url = $host["url"];

// go through variable and assign a value
Expand Down

0 comments on commit ec42f88

Please sign in to comment.