1
+ <?php
2
+
3
+ class FakeGuzzleClient implements \GuzzleHttp \ClientInterface
4
+ {
5
+
6
+ private $ str_url ;
7
+
8
+ private $ arr_params ;
9
+
10
+ /**
11
+ * Pretend to do a POST request
12
+ *
13
+ * @param $str_url
14
+ * @param array $arr_params
15
+ * @return \GuzzleHttp\Psr7\Response
16
+ */
17
+ public function post ($ str_url , array $ arr_params )
18
+ {
19
+ // echo $str_url, '::', print_r($arr_params, true), PHP_EOL;
20
+ $ this ->str_url = $ str_url ;
21
+ $ this ->arr_params = $ arr_params ;
22
+ return new \GuzzleHttp \Psr7 \Response ();
23
+ }
24
+
25
+ public function getPostedUrl ()
26
+ {
27
+ return $ this ->str_url ;
28
+ }
29
+
30
+ public function getPostedParams ()
31
+ {
32
+ return $ this ->arr_params ;
33
+ }
34
+
35
+ /**
36
+ * Send an HTTP request.
37
+ *
38
+ * @param \Psr\Http\Message\RequestInterface $request Request to send
39
+ * @param array $options Request options to apply to the given
40
+ * request and to the transfer.
41
+ *
42
+ * @return \Psr\Http\Message\ResponseInterface
43
+ * @throws \GuzzleHttp\Exception\GuzzleException
44
+ */
45
+ public function send (\Psr \Http \Message \RequestInterface $ request , array $ options = [])
46
+ {
47
+ // TODO: Implement send() method.
48
+ }
49
+
50
+ /**
51
+ * Asynchronously send an HTTP request.
52
+ *
53
+ * @param \Psr\Http\Message\RequestInterface $request Request to send
54
+ * @param array $options Request options to apply to the given
55
+ * request and to the transfer.
56
+ *
57
+ * @return \GuzzleHttp\Promise\PromiseInterface
58
+ */
59
+ public function sendAsync (\Psr \Http \Message \RequestInterface $ request , array $ options = [])
60
+ {
61
+ // TODO: Implement sendAsync() method.
62
+ }
63
+
64
+ /**
65
+ * Create and send an HTTP request.
66
+ *
67
+ * Use an absolute path to override the base path of the client, or a
68
+ * relative path to append to the base path of the client. The URL can
69
+ * contain the query string as well.
70
+ *
71
+ * @param string $method HTTP method.
72
+ * @param string|\Psr\Http\Message\UriInterface $uri URI object or string.
73
+ * @param array $options Request options to apply.
74
+ *
75
+ * @return \Psr\Http\Message\ResponseInterface
76
+ * @throws \GuzzleHttp\Exception\GuzzleException
77
+ */
78
+ public function request ($ method , $ uri , array $ options = [])
79
+ {
80
+ // TODO: Implement request() method.
81
+ }
82
+
83
+ /**
84
+ * Create and send an asynchronous HTTP request.
85
+ *
86
+ * Use an absolute path to override the base path of the client, or a
87
+ * relative path to append to the base path of the client. The URL can
88
+ * contain the query string as well. Use an array to provide a URL
89
+ * template and additional variables to use in the URL template expansion.
90
+ *
91
+ * @param string $method HTTP method
92
+ * @param string|\Psr\Http\Message\UriInterface $uri URI object or string.
93
+ * @param array $options Request options to apply.
94
+ *
95
+ * @return \GuzzleHttp\Promise\PromiseInterface
96
+ */
97
+ public function requestAsync ($ method , $ uri , array $ options = [])
98
+ {
99
+ // TODO: Implement requestAsync() method.
100
+ }
101
+
102
+ /**
103
+ * Get a client configuration option.
104
+ *
105
+ * These options include default request options of the client, a "handler"
106
+ * (if utilized by the concrete client), and a "base_uri" if utilized by
107
+ * the concrete client.
108
+ *
109
+ * @param string|null $option The config option to retrieve.
110
+ *
111
+ * @return mixed
112
+ */
113
+ public function getConfig ($ option = null )
114
+ {
115
+ // TODO: Implement getConfig() method.
116
+ }
117
+
118
+ }
0 commit comments