← All changes
|
includes/sdk/google/google/gax/src/Options/CallOptions.php
+24
-17
1.2.2
→
1.4.1
View file →
| @@ -29,22 +29,22 @@ | ||
| 29 | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 30 | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 31 | 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | 32 | */ |
| 33 | -namespace Dudlewebs\WPMCS\Google\ApiCore\Options; | |
| 33 | +namespace Dudlewebs\WPMCS\GCP\Google\ApiCore\Options; | |
| 34 | 34 | |
| 35 | 35 | use ArrayAccess; |
| 36 | -use Dudlewebs\WPMCS\Google\ApiCore\CredentialsWrapper; | |
| 37 | -use Dudlewebs\WPMCS\Google\ApiCore\RetrySettings; | |
| 38 | -use Dudlewebs\WPMCS\Google\ApiCore\TransportInterface; | |
| 36 | +use Dudlewebs\WPMCS\GCP\Google\ApiCore\CredentialsWrapper; | |
| 37 | +use Dudlewebs\WPMCS\GCP\Google\ApiCore\RetrySettings; | |
| 39 | 38 | /** |
| 40 | 39 | * The CallOptions class provides typing to the associative array of options |
| 41 | - * passed to transport RPC methods. See {@see TransportInterface::startUnaryCall()}, | |
| 42 | - * {@see TransportInterface::startBidiStreamingCall()}, | |
| 43 | - * {@see TransportInterface::startClientStreamingCall()}, and | |
| 44 | - * {@see TransportInterface::startServerStreamingCall()}. | |
| 40 | + * passed to transport RPC methods. See | |
| 41 | + * {@see \Google\ApiCore\Transport\TransportInterface::startUnaryCall()}, | |
| 42 | + * {@see \Google\ApiCore\Transport\TransportInterface::startBidiStreamingCall()}, | |
| 43 | + * {@see \Google\ApiCore\Transport\TransportInterface::startClientStreamingCall()}, and | |
| 44 | + * {@see \Google\ApiCore\Transport\TransportInterface::startServerStreamingCall()}. | |
| 45 | 45 | */ |
| 46 | -class CallOptions implements ArrayAccess | |
| 46 | +class CallOptions implements ArrayAccess, OptionsInterface | |
| 47 | 47 | { |
| 48 | 48 | use OptionsTrait; |
| 49 | 49 | private array $headers; |
| 50 | 50 | private ?int $timeoutMillis; |
| @@ -54,10 +54,10 @@ | ||
| 54 | 54 | /** |
| 55 | 55 | * @param array $options { |
| 56 | 56 | * Call options |
| 57 | 57 | * |
| 58 | - * @type array $headers | |
| 59 | - * Key-value array containing headers | |
| 58 | + * @type array<string, array<string>> $headers | |
| 59 | + * Key-value array containing headers. | |
| 60 | 60 | * @type int $timeoutMillis |
| 61 | 61 | * The timeout in milliseconds for the call. |
| 62 | 62 | * @type array $transportOptions |
| 63 | 63 | * Transport-specific call options. See {@see CallOptions::setTransportOptions}. |
| @@ -76,9 +76,9 @@ | ||
| 76 | 76 | * Sets the array of options as class properites. |
| 77 | 77 | * |
| 78 | 78 | * @param array $arr See the constructor for the list of supported options. |
| 79 | 79 | */ |
| 80 | - private function fromArray(array $arr): void | |
| 80 | + private function fromArray(array $arr) : void | |
| 81 | 81 | { |
| 82 | 82 | $this->setHeaders($arr['headers'] ?? []); |
| 83 | 83 | $this->setTimeoutMillis($arr['timeoutMillis'] ?? null); |
| 84 | 84 | $this->setTransportOptions($arr['transportOptions'] ?? []); |
| @@ -86,18 +86,20 @@ | ||
| 86 | 86 | } |
| 87 | 87 | /** |
| 88 | 88 | * @param array $headers |
| 89 | 89 | */ |
| 90 | - public function setHeaders(array $headers) | |
| 90 | + public function setHeaders(array $headers) : self | |
| 91 | 91 | { |
| 92 | 92 | $this->headers = $headers; |
| 93 | + return $this; | |
| 93 | 94 | } |
| 94 | 95 | /** |
| 95 | 96 | * @param int|null $timeoutMillis |
| 96 | 97 | */ |
| 97 | - public function setTimeoutMillis(?int $timeoutMillis) | |
| 98 | + public function setTimeoutMillis(?int $timeoutMillis) : self | |
| 98 | 99 | { |
| 99 | 100 | $this->timeoutMillis = $timeoutMillis; |
| 101 | + return $this; | |
| 100 | 102 | } |
| 101 | 103 | /** |
| 102 | 104 | * @param array $transportOptions { |
| 103 | 105 | * Transport-specific call-time options. |
| @@ -116,23 +118,28 @@ | ||
| 116 | 118 | * callable. By default these are passed to {@see \GuzzleHttp\Client} as request options. |
| 117 | 119 | * See {@link https://docs.guzzlephp.org/en/stable/request-options.html}. |
| 118 | 120 | * } |
| 119 | 121 | */ |
| 120 | - public function setTransportOptions(array $transportOptions) | |
| 122 | + public function setTransportOptions(array $transportOptions) : self | |
| 121 | 123 | { |
| 122 | 124 | $this->transportOptions = $transportOptions; |
| 125 | + return $this; | |
| 123 | 126 | } |
| 124 | 127 | /** |
| 125 | 128 | * @deprecated use CallOptions::setTransportOptions |
| 126 | 129 | */ |
| 127 | - public function setTransportSpecificOptions(array $transportSpecificOptions) | |
| 130 | + public function setTransportSpecificOptions(array $transportSpecificOptions) : self | |
| 128 | 131 | { |
| 129 | 132 | $this->setTransportOptions($transportSpecificOptions); |
| 133 | + return $this; | |
| 130 | 134 | } |
| 131 | 135 | /** |
| 132 | 136 | * @param RetrySettings|array|null $retrySettings |
| 137 | + * | |
| 138 | + * @return $this | |
| 133 | 139 | */ |
| 134 | - public function setRetrySettings($retrySettings) | |
| 140 | + public function setRetrySettings($retrySettings) : self | |
| 135 | 141 | { |
| 136 | 142 | $this->retrySettings = $retrySettings; |
| 143 | + return $this; | |
| 137 | 144 | } |
| 138 | 145 | } |