Completed
Branch develop (205409)
by Timothy
07:06
created

KitsuRequestBuilder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A setJsonBody() 0 5 1
1
<?php declare(strict_types=1);
2
/**
3
 * Anime List Client
4
 *
5
 * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
6
 *
7
 * PHP version 7
8
 *
9
 * @package     AnimeListClient
10
 * @author      Timothy J. Warren <[email protected]>
11
 * @copyright   2015 - 2017  Timothy J. Warren
12
 * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
 * @version     4.0
14
 * @link        https://github.com/timw4mail/HummingBirdAnimeClient
15
 */
16
17
namespace Aviat\AnimeClient\API\Kitsu;
18
19
use Aviat\AnimeClient\API\APIRequestBuilder;
20
use Aviat\AnimeClient\API\Kitsu as K;
21
use Aviat\Ion\Json;
22
23
class KitsuRequestBuilder extends APIRequestBuilder {	
24
	
25
	/**
26
	 * The base url for api requests
27
	 * @var string $base_url
28
	 */
29
	protected $baseUrl = "https://kitsu.io/api/edge/";
30
31
	/**
32
	 * HTTP headers to send with every request
33
	 *
34
	 * @var array
35
	 */
36
	protected $defaultHeaders = [
37
		'User-Agent' => "Tim's Anime Client/4.0",
38
		'Accept-Encoding' => 'application/vnd.api+json',
39
		'Content-Type' => 'application/vnd.api+json',
40
		'client_id' => 'dd031b32d2f56c990b1425efe6c42ad847e7fe3ab46bf1299f05ecd856bdb7dd',
41
		'client_secret' => '54d7307928f63414defd96399fc31ba847961ceaecef3a5fd93144e960c0e151',
42
	];
43
	
44
	/**
45
	 * Set the request body
46
	 *
47
	 * @param array|FormBody|string $body
48
	 * @return self
49
	 */
50
	public function setJsonBody(array $body): self
51
	{
52
		$requestBody = Json::encode($body);
53
		return $this->setBody($requestBody);
54
	}
55
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
56