googleanalytics
/
lib
/
analytics-admin
/
vendor
/
google
/
grpc-gcp
/
src
/
CreatedByDeserializeCheck.php
generated
3 years ago
ChannelRef.php
3 years ago
Config.php
3 years ago
CreatedByDeserializeCheck.php
3 years ago
GCPBidiStreamingCall.php
3 years ago
GCPCallInvoker.php
3 years ago
GCPClientStreamCall.php
3 years ago
GCPServerStreamCall.php
3 years ago
GCPUnaryCall.php
3 years ago
GcpBaseCall.php
3 years ago
GcpExtensionChannel.php
3 years ago
grpc_gcp.proto
3 years ago
CreatedByDeserializeCheck.php
69 lines
| 1 | <?php |
| 2 | /* |
| 3 | * |
| 4 | * Copyright 2018 gRPC authors. |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | * |
| 18 | */ |
| 19 | namespace Grpc\Gcp; |
| 20 | |
| 21 | /** |
| 22 | * DeserializeCheck is used to check whether _ChannelRef is created by deserialization or not. |
| 23 | * If it is, $real_channel is invalid thus we need to recreate it using $opts. |
| 24 | * If not, we can use $real_channel directly instead of creating a new one. |
| 25 | * It is useful to handle 'force_new' channel option. |
| 26 | * This is a private class |
| 27 | */ |
| 28 | class CreatedByDeserializeCheck implements \Serializable |
| 29 | { |
| 30 | // TODO(ddyihai): remove it once the serialzer handler for \Grpc\Channel is implemented. |
| 31 | private $data; |
| 32 | public function __construct() |
| 33 | { |
| 34 | $this->data = 1; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @return string |
| 39 | */ |
| 40 | public function serialize() |
| 41 | { |
| 42 | return '0'; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @param string $data |
| 47 | */ |
| 48 | public function unserialize($data) |
| 49 | { |
| 50 | $this->data = 1; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * @param $data |
| 55 | */ |
| 56 | public function setData($data) |
| 57 | { |
| 58 | $this->data = $data; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return int |
| 63 | */ |
| 64 | public function getData() |
| 65 | { |
| 66 | return $this->data; |
| 67 | } |
| 68 | } |
| 69 |