Skip to content
This repository was archived by the owner on Feb 17, 2023. It is now read-only.

Commit bf0b6ce

Browse files
committed
fix(standard): apply standard syntax fixes
1 parent 61b8fde commit bf0b6ce

2 files changed

Lines changed: 31 additions & 31 deletions

File tree

src/targets/java/okhttp.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ module.exports = function (source, options) {
2020

2121
var code = new CodeBuilder(opts.indent)
2222

23-
var methods = [ 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD']
23+
var methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD']
2424

25-
var methodsWithBody = [ 'POST', 'PUT', 'DELETE', 'PATCH']
25+
var methodsWithBody = ['POST', 'PUT', 'DELETE', 'PATCH']
2626

2727
code.push('OkHttpClient client = new OkHttpClient();')
28-
.blank()
28+
.blank()
2929

3030
if (source.postData.text) {
3131
if (source.postData.boundary) {
3232
code.push('MediaType mediaType = MediaType.parse("%s; boundary=%s");', source.postData.mimeType, source.postData.boundary)
33-
}else {
33+
} else {
3434
code.push('MediaType mediaType = MediaType.parse("%s");', source.postData.mimeType)
3535
}
3636
code.push('RequestBody body = RequestBody.create(mediaType, %s);', JSON.stringify(source.postData.text))
@@ -41,13 +41,13 @@ module.exports = function (source, options) {
4141
if (methods.indexOf(source.method.toUpperCase()) === -1) {
4242
if (source.postData.text) {
4343
code.push(1, '.method("%s", body)', source.method.toUpperCase())
44-
}else {
44+
} else {
4545
code.push(1, '.method("%s", null)', source.method.toUpperCase())
4646
}
4747
}else if (methodsWithBody.indexOf(source.method.toUpperCase()) >= 0) {
4848
if (source.postData.text) {
4949
code.push(1, '.%s(body)', source.method.toLowerCase())
50-
}else {
50+
} else {
5151
code.push(1, '.%s(null)', source.method.toLowerCase())
5252
}
5353
} else {
@@ -65,8 +65,8 @@ module.exports = function (source, options) {
6565
}
6666

6767
code.push(1, '.build();')
68-
.blank()
69-
.push('Response response = client.newCall(request).execute();')
68+
.blank()
69+
.push('Response response = client.newCall(request).execute();')
7070

7171
return code.join()
7272
}

src/targets/php/curl.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,45 +28,45 @@ module.exports = function (source, options) {
2828

2929
if (!opts.noTags) {
3030
code.push(opts.shortTags ? '<?' : '<?php')
31-
.blank()
31+
.blank()
3232
}
3333

3434
code.push('$curl = curl_init();')
35-
.blank()
35+
.blank()
3636

3737
var curlOptions = [{
3838
escape: true,
3939
name: 'CURLOPT_PORT',
4040
value: source.uriObj.port
41-
}, {
41+
}, {
4242
escape: true,
4343
name: 'CURLOPT_URL',
4444
value: source.fullUrl
45-
}, {
45+
}, {
4646
escape: false,
4747
name: 'CURLOPT_RETURNTRANSFER',
4848
value: 'true'
49-
}, {
49+
}, {
5050
escape: true,
5151
name: 'CURLOPT_ENCODING',
5252
value: ''
53-
}, {
53+
}, {
5454
escape: false,
5555
name: 'CURLOPT_MAXREDIRS',
5656
value: opts.maxRedirects
57-
}, {
57+
}, {
5858
escape: false,
5959
name: 'CURLOPT_TIMEOUT',
6060
value: opts.timeout
61-
}, {
61+
}, {
6262
escape: false,
6363
name: 'CURLOPT_HTTP_VERSION',
6464
value: source.httpVersion === 'HTTP/1.0' ? 'CURL_HTTP_VERSION_1_0' : 'CURL_HTTP_VERSION_1_1'
65-
}, {
65+
}, {
6666
escape: true,
6767
name: 'CURLOPT_CUSTOMREQUEST',
6868
value: source.method
69-
}, {
69+
}, {
7070
escape: true,
7171
name: 'CURLOPT_POSTFIELDS',
7272
value: source.postData ? source.postData.text : undefined
@@ -98,19 +98,19 @@ module.exports = function (source, options) {
9898

9999
if (headers.length) {
100100
curlopts.push('CURLOPT_HTTPHEADER => array(')
101-
.push(1, headers.join(',\n' + opts.indent + opts.indent))
102-
.push('),')
101+
.push(1, headers.join(',\n' + opts.indent + opts.indent))
102+
.push('),')
103103
}
104104

105105
code.push(1, curlopts.join())
106-
.push('));')
107-
.blank()
108-
.push('$response = curl_exec($curl);')
109-
.push('$err = curl_error($curl);')
110-
.blank()
111-
.push('curl_close($curl);')
112-
.blank()
113-
.push('if ($err) {')
106+
.push('));')
107+
.blank()
108+
.push('$response = curl_exec($curl);')
109+
.push('$err = curl_error($curl);')
110+
.blank()
111+
.push('curl_close($curl);')
112+
.blank()
113+
.push('if ($err) {')
114114

115115
if (opts.namedErrors) {
116116
code.push(1, 'echo array_flip(get_defined_constants(true)["curl"])[$err];')
@@ -119,12 +119,12 @@ module.exports = function (source, options) {
119119
}
120120

121121
code.push('} else {')
122-
.push(1, 'echo $response;')
123-
.push('}')
122+
.push(1, 'echo $response;')
123+
.push('}')
124124

125125
if (!opts.noTags && opts.closingTag) {
126126
code.blank()
127-
.push('?>')
127+
.push('?>')
128128
}
129129

130130
return code.join()

0 commit comments

Comments
 (0)