Skip to content

Commit 86ed5f6

Browse files
committed
rename methods to use callOptions instead of optionalArgs
1 parent a62536c commit 86ed5f6

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

src/GapicClientTrait.php

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ private function validateCallConfig(string $methodName)
476476
/**
477477
* @param string $methodName
478478
* @param Message $request
479-
* @param array $optionalArgs {
479+
* @param array $callOptions {
480480
* Call Options
481481
*
482482
* @type array $headers [optional] key-value array containing headers
@@ -492,7 +492,7 @@ private function validateCallConfig(string $methodName)
492492
private function startAsyncCall(
493493
string $methodName,
494494
Message $request,
495-
array $optionalArgs = []
495+
array $callOptions = []
496496
) {
497497
// Convert method name to the UpperCamelCase of RPC names from lowerCamelCase of GAPIC method names
498498
// in order to find the method in the descriptor config.
@@ -505,7 +505,7 @@ private function startAsyncCall(
505505
case Call::PAGINATED_CALL:
506506
return $this->getPagedListResponseAsync(
507507
$methodName,
508-
$optionalArgs,
508+
$callOptions,
509509
$methodDescriptors['responseType'],
510510
$request,
511511
$methodDescriptors['interfaceOverride'] ?? $this->serviceName
@@ -517,13 +517,13 @@ private function startAsyncCall(
517517
"'$methodName' is not supported for async execution.");
518518
}
519519

520-
return $this->startApiCall($methodName, $request, $optionalArgs);
520+
return $this->startApiCall($methodName, $request, $callOptions);
521521
}
522522

523523
/**
524524
* @param string $methodName
525525
* @param Message $request
526-
* @param array $optionalArgs {
526+
* @param array $callOptions {
527527
* Call Options
528528
*
529529
* @type array $headers [optional] key-value array containing headers
@@ -540,7 +540,7 @@ private function startAsyncCall(
540540
private function startApiCall(
541541
string $methodName,
542542
?Message $request = null,
543-
array $optionalArgs = []
543+
array $callOptions = []
544544
) {
545545
$methodDescriptors = $this->validateCallConfig($methodName);
546546
$callType = $methodDescriptors['callType'];
@@ -549,7 +549,7 @@ private function startApiCall(
549549
// which take precedence.
550550
$headerParams = $methodDescriptors['headerParams'] ?? [];
551551
$requestHeaders = $this->buildRequestParamsHeader($headerParams, $request);
552-
$optionalArgs['headers'] = array_merge($requestHeaders, $optionalArgs['headers'] ?? []);
552+
$callOptions['headers'] = array_merge($requestHeaders, $callOptions['headers'] ?? []);
553553

554554
// Default the interface name, if not set, to the client's protobuf service name.
555555
$interfaceName = $methodDescriptors['interfaceOverride'] ?? $this->serviceName;
@@ -558,7 +558,7 @@ private function startApiCall(
558558
if ($callType == Call::LONGRUNNING_CALL) {
559559
return $this->startOperationsCall(
560560
$methodName,
561-
$optionalArgs,
561+
$callOptions,
562562
$request,
563563
$this->getOperationsClient(),
564564
$interfaceName,
@@ -572,17 +572,17 @@ private function startApiCall(
572572
$decodeType = $methodDescriptors['responseType'];
573573

574574
if ($callType == Call::PAGINATED_CALL) {
575-
return $this->getPagedListResponse($methodName, $optionalArgs, $decodeType, $request, $interfaceName);
575+
return $this->getPagedListResponse($methodName, $callOptions, $decodeType, $request, $interfaceName);
576576
}
577577

578578
// Unary, and all Streaming types handled by startCall.
579-
return $this->startCall($methodName, $decodeType, $optionalArgs, $request, $callType, $interfaceName);
579+
return $this->startCall($methodName, $decodeType, $callOptions, $request, $callType, $interfaceName);
580580
}
581581

582582
/**
583583
* @param string $methodName
584584
* @param string $decodeType
585-
* @param array $optionalArgs {
585+
* @param array $callOptions {
586586
* Call Options
587587
*
588588
* @type array $headers [optional] key-value array containing headers
@@ -600,14 +600,14 @@ private function startApiCall(
600600
private function startCall(
601601
string $methodName,
602602
string $decodeType,
603-
array $optionalArgs = [],
603+
array $callOptions = [],
604604
?Message $request = null,
605605
int $callType = Call::UNARY_CALL,
606606
?string $interfaceName = null
607607
) {
608-
$optionalArgs = $this->configureCallOptions($optionalArgs);
608+
$callOptions = $this->configureCallOptions($callOptions);
609609
$callStack = $this->createCallStack(
610-
$this->configureCallConstructionOptions($methodName, $optionalArgs)
610+
$this->configureCallConstructionOptions($methodName, $callOptions)
611611
);
612612

613613
$descriptor = $this->descriptors[$methodName]['grpcStreaming'] ?? null;
@@ -630,7 +630,7 @@ private function startCall(
630630
break;
631631
}
632632

633-
return $callStack($call, $optionalArgs + array_filter([
633+
return $callStack($call, $callOptions + array_filter([
634634
'audience' => self::getDefaultAudience()
635635
]));
636636
}
@@ -692,7 +692,7 @@ private function createCallStack(array $callConstructionOptions)
692692

693693
/**
694694
* @param string $methodName
695-
* @param array $optionalArgs {
695+
* @param array $callOptions {
696696
* Optional arguments
697697
*
698698
* @type RetrySettings|array $retrySettings [optional] A retry settings
@@ -701,17 +701,17 @@ private function createCallStack(array $callConstructionOptions)
701701
*
702702
* @return array
703703
*/
704-
private function configureCallConstructionOptions(string $methodName, array $optionalArgs)
704+
private function configureCallConstructionOptions(string $methodName, array $callOptions)
705705
{
706706
$retrySettings = $this->retrySettings[$methodName];
707707
$autoPopulatedFields = $this->descriptors[$methodName]['autoPopulatedFields'] ?? [];
708708
// Allow for retry settings to be changed at call time
709-
if (isset($optionalArgs['retrySettings'])) {
710-
if ($optionalArgs['retrySettings'] instanceof RetrySettings) {
711-
$retrySettings = $optionalArgs['retrySettings'];
709+
if (isset($callOptions['retrySettings'])) {
710+
if ($callOptions['retrySettings'] instanceof RetrySettings) {
711+
$retrySettings = $callOptions['retrySettings'];
712712
} else {
713713
$retrySettings = $retrySettings->with(
714-
$optionalArgs['retrySettings']
714+
$callOptions['retrySettings']
715715
);
716716
}
717717
}
@@ -724,18 +724,18 @@ private function configureCallConstructionOptions(string $methodName, array $opt
724724
/**
725725
* @return array
726726
*/
727-
private function configureCallOptions(array $optionalArgs): array
727+
private function configureCallOptions(array $callOptions): array
728728
{
729729
if ($this->isBackwardsCompatibilityMode()) {
730-
return $optionalArgs;
730+
return $callOptions;
731731
}
732732
// cast to CallOptions for new surfaces only
733-
return (new CallOptions($optionalArgs))->toArray();
733+
return (new CallOptions($callOptions))->toArray();
734734
}
735735

736736
/**
737737
* @param string $methodName
738-
* @param array $optionalArgs {
738+
* @param array $callOptions {
739739
* Call Options
740740
*
741741
* @type array $headers [optional] key-value array containing headers
@@ -752,15 +752,15 @@ private function configureCallOptions(array $optionalArgs): array
752752
*/
753753
private function startOperationsCall(
754754
string $methodName,
755-
array $optionalArgs,
755+
array $callOptions,
756756
Message $request,
757757
$client,
758758
?string $interfaceName = null,
759759
?string $operationClass = null
760760
) {
761-
$optionalArgs = $this->configureCallOptions($optionalArgs);
761+
$callOptions = $this->configureCallOptions($callOptions);
762762
$callStack = $this->createCallStack(
763-
$this->configureCallConstructionOptions($methodName, $optionalArgs)
763+
$this->configureCallConstructionOptions($methodName, $callOptions)
764764
);
765765
$descriptor = $this->descriptors[$methodName]['longRunning'];
766766
$metadataReturnType = null;
@@ -791,15 +791,15 @@ private function startOperationsCall(
791791
);
792792

793793
$this->modifyUnaryCallable($callStack);
794-
return $callStack($call, $optionalArgs + array_filter([
794+
return $callStack($call, $callOptions + array_filter([
795795
'metadataReturnType' => $metadataReturnType,
796796
'audience' => self::getDefaultAudience()
797797
]));
798798
}
799799

800800
/**
801801
* @param string $methodName
802-
* @param array $optionalArgs
802+
* @param array $callOptions
803803
* @param string $decodeType
804804
* @param Message $request
805805
* @param string $interfaceName
@@ -808,14 +808,14 @@ private function startOperationsCall(
808808
*/
809809
private function getPagedListResponse(
810810
string $methodName,
811-
array $optionalArgs,
811+
array $callOptions,
812812
string $decodeType,
813813
Message $request,
814814
?string $interfaceName = null
815815
) {
816816
return $this->getPagedListResponseAsync(
817817
$methodName,
818-
$optionalArgs,
818+
$callOptions,
819819
$decodeType,
820820
$request,
821821
$interfaceName
@@ -824,7 +824,7 @@ private function getPagedListResponse(
824824

825825
/**
826826
* @param string $methodName
827-
* @param array $optionalArgs
827+
* @param array $callOptions
828828
* @param string $decodeType
829829
* @param Message $request
830830
* @param string $interfaceName
@@ -833,14 +833,14 @@ private function getPagedListResponse(
833833
*/
834834
private function getPagedListResponseAsync(
835835
string $methodName,
836-
array $optionalArgs,
836+
array $callOptions,
837837
string $decodeType,
838838
Message $request,
839839
?string $interfaceName = null
840840
) {
841-
$optionalArgs = $this->configureCallOptions($optionalArgs);
841+
$callOptions = $this->configureCallOptions($callOptions);
842842
$callStack = $this->createCallStack(
843-
$this->configureCallConstructionOptions($methodName, $optionalArgs)
843+
$this->configureCallConstructionOptions($methodName, $callOptions)
844844
);
845845
$descriptor = new PageStreamingDescriptor(
846846
$this->descriptors[$methodName]['pageStreaming']
@@ -856,7 +856,7 @@ private function getPagedListResponseAsync(
856856
);
857857

858858
$this->modifyUnaryCallable($callStack);
859-
return $callStack($call, $optionalArgs + array_filter([
859+
return $callStack($call, $callOptions + array_filter([
860860
'audience' => self::getDefaultAudience()
861861
]));
862862
}

0 commit comments

Comments
 (0)