PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
media-cloud-sync / includes / sdk / google / google / gax / src / Options / TransportOptions.php

TransportOptions.php in Media Cloud Sync 1.4.2, at includes/sdk/google/google/gax/src/Options/TransportOptions.php

100 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * Copyright 2023 Google LLC
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following disclaimer
15 * in the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name of Google Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 namespace Dudlewebs\WPMCS\GCP\Google\ApiCore\Options;
34
35 use ArrayAccess;
36 use Dudlewebs\WPMCS\GCP\Google\ApiCore\Options\TransportOptions\GrpcFallbackTransportOptions;
37 use Dudlewebs\WPMCS\GCP\Google\ApiCore\Options\TransportOptions\GrpcTransportOptions;
38 use Dudlewebs\WPMCS\GCP\Google\ApiCore\Options\TransportOptions\RestTransportOptions;
39 class TransportOptions implements ArrayAccess, OptionsInterface
40 {
41 use OptionsTrait;
42 private GrpcTransportOptions $grpc;
43 private GrpcFallbackTransportOptions $grpcFallback;
44 private RestTransportOptions $rest;
45 /**
46 * @param array $options {
47 * Config options used to construct the transport.
48 *
49 * @type array $grpc
50 * @type array $grpcFallback
51 * @type array $rest
52 * }
53 */
54 public function __construct(array $options)
55 {
56 $this->fromArray($options);
57 }
58 /**
59 * Sets the array of options as class properites.
60 *
61 * @param array $arr See the constructor for the list of supported options.
62 */
63 private function fromArray(array $arr) : void
64 {
65 $this->setGrpc(new GrpcTransportOptions($arr['grpc'] ?? []));
66 $this->setGrpcFallback(new GrpcFallbackTransportOptions($arr['grpc-fallback'] ?? []));
67 $this->setRest(new RestTransportOptions($arr['rest'] ?? []));
68 }
69 /**
70 * @param GrpcTransportOptions $grpc
71 *
72 * @return $this
73 */
74 public function setGrpc(GrpcTransportOptions $grpc) : self
75 {
76 $this->grpc = $grpc;
77 return $this;
78 }
79 /**
80 * @param GrpcFallbackTransportOptions $grpcFallback
81 *
82 * @return $this
83 */
84 public function setGrpcFallback(GrpcFallbackTransportOptions $grpcFallback) : self
85 {
86 $this->grpcFallback = $grpcFallback;
87 return $this;
88 }
89 /**
90 * @param RestTransportOptions $rest
91 *
92 * @return $this
93 */
94 public function setRest(RestTransportOptions $rest) : self
95 {
96 $this->rest = $rest;
97 return $this;
98 }
99 }
100