Skip to content

Commit 2d40ecb

Browse files
committed
Apply more suggestions for method names
1 parent a514f52 commit 2d40ecb

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

docs/migrate-to-nativecurlclient.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Replace every calls for `$client->getResponseCode()` with `$client->getLastRespo
3030
}
3131
```
3232

33-
### get() to requestGet()
33+
### `get()` -> `requestGet()`
3434

3535
If you are using `$client->get()`, `$client->post()`, `$client->put()` or
3636
`$client->delete()` directly you will have to change your code. This methods
@@ -82,7 +82,7 @@ This example shows how you can parse the response body of a POST request.
8282
+}
8383
```
8484

85-
### put() to requestPut()
85+
### `put()` -> `requestPut()`
8686

8787
This example shows how you can parse the response body of a PUT request.
8888

@@ -101,7 +101,7 @@ This example shows how you can parse the response body of a PUT request.
101101
+}
102102
```
103103

104-
### delete() to requestDelete()
104+
### `delete()` -> `requestDelete()`
105105

106106
This example shows how you can parse the response body of a DELETE request.
107107

@@ -111,7 +111,7 @@ This example shows how you can parse the response body of a DELETE request.
111111
+$dataAsString = $this->client->getLastResponseBody();
112112
```
113113

114-
### setImpersonateUser() to startImpersonateUser()
114+
### `setImpersonateUser()` -> `startImpersonateUser()`
115115

116116
If you are using the [Redmine user impersonation](https://www.redmine.org/projects/redmine/wiki/Rest_api#User-Impersonation)
117117
you have to change your code as follow :
@@ -128,28 +128,28 @@ $userData = $client->getApi('user')->getCurrentUser();
128128
+$client->stopImpersonateUser();
129129
```
130130

131-
### setCheckSslCertificate() to setCurlOption()
131+
### `setCheckSslCertificate()` -> `setCurlOption()`
132132

133133
```diff
134134
-$client->setCheckSslCertificate(true);
135135
+$client->setCurlOption(CURLOPT_SSL_VERIFYPEER, true);
136136
```
137137

138-
### setCheckSslHost() to setCurlOption()
138+
### `setCheckSslHost()` -> `setCurlOption()`
139139

140140
```diff
141141
-$client->setCheckSslHost(true);
142142
+$client->setCurlOption(CURLOPT_SSL_VERIFYHOST, 2);
143143
```
144144

145-
### setSslVersion() to setCurlOption()
145+
### `setSslVersion()` -> `setCurlOption()`
146146

147147
```diff
148148
-$client->setSslVersion(true);
149149
+$client->setCurlOption(CURLOPT_SSLVERSION, CURL_SSLVERSION_DEFAULT);
150150
```
151151

152-
### setUseHttpAuth() can be removed
152+
### `setUseHttpAuth()` can be removed
153153

154154
Authorization for Redmine uses always the http headers `X-Redmine-API-Key` or
155155
`Authorization`. So the setting `setUseHttpAuth()` is not longer needed.
@@ -168,21 +168,21 @@ can set them via `setCurlOption()` method.
168168
+$client->setCurlOption(CURLOPT_HTTPHEADER, ['X-Redmine-API-Key: secret_access_key']);
169169
```
170170

171-
### setPort() to setCurlOption()
171+
### `setPort()` -> `setCurlOption()`
172172

173173
```diff
174174
-$client->setPort(8080);
175175
+$client->setCurlOption(CURLOPT_PORT, 8080);
176176
```
177177

178-
### getResponseCode() to getLastResponseStatusCode()
178+
### `getResponseCode()` -> `getLastResponseStatusCode()`
179179

180180
```diff
181181
-$statusCode = $client->getResponseCode();
182182
+$statuscode = $client->getLastResponseStatusCode();
183183
```
184184

185-
### setImpersonateUser() to startImpersonateUser()
185+
### `setImpersonateUser()` -> `startImpersonateUser()`
186186

187187
```diff
188188
// impersonate the user `robin`
@@ -196,7 +196,7 @@ $userData = $client->getApi('user')->getCurrentUser();
196196
+$client->stopImpersonateUser();
197197
```
198198

199-
### setCustomHost() to setCurlOption()
199+
### `setCustomHost()` -> `setCurlOption()`
200200

201201
```diff
202202
-$client->setCustomHost('http://custom.example.com');

docs/migrate-to-psr18client.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Since `php-redmine-api` v1.7.0 there is a new PSR-18 based client `Redmine\Clien
66

77
With the new interface `Redmine\Client\Client` there are now standarized methods for all clients. The new `Redmine\Client\Psr18Client` and the current `Redmine\Client` implementing this interface.
88

9-
### api() to getApi()
9+
### `api()` -> `getApi()`
1010

1111
Search in your code for the usage of `$client->api('issue')` and the magic getter like `$client->issue`. Then replace this calls with `$client->getApi('issue')`.
1212

@@ -18,7 +18,7 @@ Search in your code for the usage of `$client->api('issue')` and the magic gette
1818
+$client->getApi('issue')->create($data);
1919
```
2020

21-
### getResponseCode() to getLastResponseStatusCode()
21+
### `getResponseCode()` -> `getLastResponseStatusCode()`
2222

2323
Replace every call for `$client->getResponseCode()` with `$client->getLastResponseStatusCode()`.
2424

@@ -30,7 +30,7 @@ Replace every call for `$client->getResponseCode()` with `$client->getLastRespon
3030
}
3131
```
3232

33-
### get() to requestGet()
33+
### `get()` -> `requestGet()`
3434

3535
If you are using `$client->get()`, `$client->post()`, `$client->put()` or `$client->delete()` directly you will have to change your code. This methods parse a possible JSON or XML response but in future the parsing of the raw response body will be up to you.
3636

@@ -59,7 +59,7 @@ This example shows how you can parse the response body of a GET request.
5959
+}
6060
```
6161

62-
### post() to requestPost()
62+
### `post()` -> `requestPost()`
6363

6464
This example shows how you can parse the response body of a POST request.
6565

@@ -78,7 +78,7 @@ This example shows how you can parse the response body of a POST request.
7878
+}
7979
```
8080

81-
### put() to requestPut()
81+
### `put()` -> `requestPut()`
8282

8383
This example shows how you can parse the response body of a PUT request.
8484

@@ -97,7 +97,7 @@ This example shows how you can parse the response body of a PUT request.
9797
+}
9898
```
9999

100-
### delete() to requestDelete()
100+
### `delete()` -> `requestDelete()`
101101

102102
This example shows how you can parse the response body of a DELETE request.
103103

@@ -107,7 +107,7 @@ This example shows how you can parse the response body of a DELETE request.
107107
+$dataAsString = $this->client->getLastResponseBody();
108108
```
109109

110-
### setImpersonateUser() to startImpersonateUser()
110+
### `setImpersonateUser()` -> `startImpersonateUser()`
111111

112112
If you are using the [Redmine user impersonation](https://www.redmine.org/projects/redmine/wiki/Rest_api#User-Impersonation) you have to change your code.
113113

0 commit comments

Comments
 (0)