Skip to content

Commit d6690ee

Browse files
committed
Refactor setHeaders
1 parent 0dbf9e7 commit d6690ee

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

lib/Github/Api/Issue/Comments.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,13 @@ class Comments extends AbstractApi
1818
*/
1919
public function configure($bodyType = null)
2020
{
21-
switch ($bodyType) {
22-
case 'raw':
23-
$header = 'Accept: application/vnd.github.%s.raw+json';
24-
break;
25-
26-
case 'text':
27-
$header = 'Accept: application/vnd.github.%s.text+json';
28-
break;
29-
30-
case 'html':
31-
$header = 'Accept: application/vnd.github.%s.html+json';
32-
break;
33-
34-
default:
35-
$header = 'Accept: application/vnd.github.%s.full+json';
21+
if (!in_array($bodyType, array('raw', 'text', 'html'))) {
22+
$bodyType = 'full';
3623
}
3724

38-
$this->client->setHeaders(array(sprintf($header, $this->client->getOption('api_version'))));
25+
$this->client->setHeaders(array(
26+
sprintf('Accept: application/vnd.github.%s.%s+json', $this->client->getOption('api_version'), $bodyType)
27+
));
3928
}
4029

4130
/**

0 commit comments

Comments
 (0)