Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Generation/ServiceDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ public function __construct(
$this->docLines = $desc->leadingComments;
$this->serviceName = "{$package}.{$desc->getName()}";
$this->shortName = $desc->getName();
$this->defaultHost = ProtoHelpers::getCustomOption($desc, CustomOptions::GOOGLE_API_DEFAULTHOST);
$this->defaultPort = 443;
$defaultHost = ProtoHelpers::getCustomOption($desc, CustomOptions::GOOGLE_API_DEFAULTHOST);
$hostParts = explode(':', $defaultHost ?? '', 2);
$this->defaultHost = $hostParts[0];
$this->defaultPort = isset($hostParts[1]) ? (int) $hostParts[1] : 443;
$this->defaultScopes =
Vector::new(explode(',', ProtoHelpers::getCustomOption($desc, CustomOptions::GOOGLE_API_OAUTHSCOPES) ?? ''))
->filter(fn ($x) => $x != '')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ final class LibraryClient
*
* @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead.
*/
private const SERVICE_ADDRESS = 'library-example.googleapis.com:1234';
private const SERVICE_ADDRESS = 'library-example.googleapis.com';

/** The address template of the service. */
private const SERVICE_ADDRESS_TEMPLATE = 'library-example.UNIVERSE_DOMAIN:1234';
private const SERVICE_ADDRESS_TEMPLATE = 'library-example.UNIVERSE_DOMAIN';

/** The default port of the service. */
private const DEFAULT_SERVICE_PORT = 443;
private const DEFAULT_SERVICE_PORT = 1234;

/** The name of the code generator, to be included in the agent header. */
private const CODEGEN_NAME = 'gapic';
Expand Down Expand Up @@ -592,7 +592,7 @@ public static function parseName(string $formattedName, ?string $template = null
*
* @type string $apiEndpoint
* The address of the API remote host. May optionally include the port, formatted
* as "<uri>:<port>". Default 'library-example.googleapis.com:1234:443'.
* as "<uri>:<port>". Default 'library-example.googleapis.com:1234'.
* @type FetchAuthTokenInterface|CredentialsWrapper $credentials
* This option should only be used with a pre-constructed
* {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START localhost:7469_generated_DeprecatedService_FastFibonacci_sync]
// [START localhost_generated_DeprecatedService_FastFibonacci_sync]
use Google\ApiCore\ApiException;
use Testing\Deprecated\Client\DeprecatedServiceClient;
use Testing\Deprecated\FibonacciRequest;
Expand Down Expand Up @@ -52,4 +52,4 @@ function fast_fibonacci_sample(): void
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
// [END localhost:7469_generated_DeprecatedService_FastFibonacci_sync]
// [END localhost_generated_DeprecatedService_FastFibonacci_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START localhost:7469_generated_DeprecatedService_SlowFibonacci_sync]
// [START localhost_generated_DeprecatedService_SlowFibonacci_sync]
use Google\ApiCore\ApiException;
use Testing\Deprecated\Client\DeprecatedServiceClient;
use Testing\Deprecated\FibonacciRequest;
Expand Down Expand Up @@ -52,4 +52,4 @@ function slow_fibonacci_sample(): void
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
// [END localhost:7469_generated_DeprecatedService_SlowFibonacci_sync]
// [END localhost_generated_DeprecatedService_SlowFibonacci_sync]
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ final class DeprecatedServiceClient
private const SERVICE_NAME = 'testing.deprecated_service.DeprecatedService';

/** The default address of the service. */
private const SERVICE_ADDRESS = 'localhost:7469';
private const SERVICE_ADDRESS = 'localhost';

/** The default port of the service. */
private const DEFAULT_SERVICE_PORT = 443;
private const DEFAULT_SERVICE_PORT = 7469;

/** The name of the code generator, to be included in the agent header. */
private const CODEGEN_NAME = 'gapic';
Expand Down Expand Up @@ -100,7 +100,7 @@ private static function getClientDefaults()
*
* @type string $apiEndpoint
* The address of the API remote host. May optionally include the port, formatted
* as "<uri>:<port>". Default 'localhost:7469:443'.
* as "<uri>:<port>". Default 'localhost:7469'.
* @type FetchAuthTokenInterface|CredentialsWrapper $credentials
* This option should only be used with a pre-constructed
* {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that
Expand Down
Loading