xref: /aosp_15_r20/external/grpc-grpc/src/php/tests/generated_code/Math/MathStub.php (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1<?php
2// GENERATED CODE -- DO NOT EDIT!
3
4// Original file comments:
5// Copyright 2015 gRPC authors.
6//
7// Licensed under the Apache License, Version 2.0 (the "License");
8// you may not use this file except in compliance with the License.
9// You may obtain a copy of the License at
10//
11//     http://www.apache.org/licenses/LICENSE-2.0
12//
13// Unless required by applicable law or agreed to in writing, software
14// distributed under the License is distributed on an "AS IS" BASIS,
15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16// See the License for the specific language governing permissions and
17// limitations under the License.
18//
19namespace Math;
20
21/**
22 */
23class MathStub {
24
25    /**
26     * Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
27     * and remainder.
28     * @param \Math\DivArgs $request client request
29     * @param \Grpc\ServerContext $context server request context
30     * @return \Math\DivReply for response data, null if if error occured
31     *     initial metadata (if any) and status (if not ok) should be set to $context
32     */
33    public function Div(
34        \Math\DivArgs $request,
35        \Grpc\ServerContext $context
36    ): ?\Math\DivReply {
37        $context->setStatus(\Grpc\Status::unimplemented());
38        return null;
39    }
40
41    /**
42     * DivMany accepts an arbitrary number of division args from the client stream
43     * and sends back the results in the reply stream.  The stream continues until
44     * the client closes its end; the server does the same after sending all the
45     * replies.  The stream ends immediately if either end aborts.
46     * @param \Grpc\ServerCallReader $reader read client request data of \Math\DivArgs
47     * @param \Grpc\ServerCallWriter $writer write response data of \Math\DivReply
48     * @param \Grpc\ServerContext $context server request context
49     * @return void
50     */
51    public function DivMany(
52        \Grpc\ServerCallReader $reader,
53        \Grpc\ServerCallWriter $writer,
54        \Grpc\ServerContext $context
55    ): void {
56        $context->setStatus(\Grpc\Status::unimplemented());
57        $writer->finish();
58    }
59
60    /**
61     * Fib generates numbers in the Fibonacci sequence.  If FibArgs.limit > 0, Fib
62     * generates up to limit numbers; otherwise it continues until the call is
63     * canceled.  Unlike Fib above, Fib has no final FibReply.
64     * @param \Math\FibArgs $request client request
65     * @param \Grpc\ServerCallWriter $writer write response data of \Math\Num
66     * @param \Grpc\ServerContext $context server request context
67     * @return void
68     */
69    public function Fib(
70        \Math\FibArgs $request,
71        \Grpc\ServerCallWriter $writer,
72        \Grpc\ServerContext $context
73    ): void {
74        $context->setStatus(\Grpc\Status::unimplemented());
75        $writer->finish();
76    }
77
78    /**
79     * Sum sums a stream of numbers, returning the final result once the stream
80     * is closed.
81     * @param \Grpc\ServerCallReader $reader read client request data of \Math\Num
82     * @param \Grpc\ServerContext $context server request context
83     * @return \Math\Num for response data, null if if error occured
84     *     initial metadata (if any) and status (if not ok) should be set to $context
85     */
86    public function Sum(
87        \Grpc\ServerCallReader $reader,
88        \Grpc\ServerContext $context
89    ): ?\Math\Num {
90        $context->setStatus(\Grpc\Status::unimplemented());
91        return null;
92    }
93
94    /**
95     * Get the method descriptors of the service for server registration
96     *
97     * @return array of \Grpc\MethodDescriptor for the service methods
98     */
99    public final function getMethodDescriptors(): array
100    {
101        return [
102            '/math.Math/Div' => new \Grpc\MethodDescriptor(
103                $this,
104                'Div',
105                '\Math\DivArgs',
106                \Grpc\MethodDescriptor::UNARY_CALL
107            ),
108            '/math.Math/DivMany' => new \Grpc\MethodDescriptor(
109                $this,
110                'DivMany',
111                '\Math\DivArgs',
112                \Grpc\MethodDescriptor::BIDI_STREAMING_CALL
113            ),
114            '/math.Math/Fib' => new \Grpc\MethodDescriptor(
115                $this,
116                'Fib',
117                '\Math\FibArgs',
118                \Grpc\MethodDescriptor::SERVER_STREAMING_CALL
119            ),
120            '/math.Math/Sum' => new \Grpc\MethodDescriptor(
121                $this,
122                'Sum',
123                '\Math\Num',
124                \Grpc\MethodDescriptor::CLIENT_STREAMING_CALL
125            ),
126        ];
127    }
128
129}
130