xref: /aosp_15_r20/external/grpc-grpc/src/php/lib/Grpc/ServerContext.php (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1<?php
2/*
3 *
4 * Copyright 2020 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
20namespace Grpc;
21
22/**
23 * This is an experimental and incomplete implementation of gRPC server
24 * for PHP. APIs are _definitely_ going to be changed.
25 *
26 * DO NOT USE in production.
27 */
28
29class ServerContext
30{
31    public function __construct($event)
32    {
33        $this->event = $event;
34    }
35
36    public function clientMetadata()
37    {
38        return $this->event->metadata;
39    }
40    public function deadline()
41    {
42        return $this->event->absolute_deadline;
43    }
44    public function host()
45    {
46        return $this->event->host;
47    }
48    public function method()
49    {
50        return $this->event->method;
51    }
52
53    public function setInitialMetadata($initialMetadata)
54    {
55        $this->initialMetadata_ = $initialMetadata;
56    }
57
58    public function initialMetadata()
59    {
60        return $this->initialMetadata_;
61    }
62
63    public function setStatus($status)
64    {
65        $this->status_ = $status;
66    }
67
68    public function status()
69    {
70        return $this->status_;
71    }
72
73    private $event;
74    private $initialMetadata_;
75    private $status_;
76}
77