GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

HTTPRequestFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A bootstrap() 0 6 1
A get() 0 6 1
A post() 0 6 1
1
<?php declare(strict_types=1);
2
/**
3
 * @license MIT
4
 * @author Samuel Adeshina <[email protected]>
5
 *
6
 * This file is part of the EmmetBlue project, please read the license document
7
 * available in the root level of the project
8
 */
9
namespace EmmetBlue\Core\Factory;
10
11
use EmmetBlue\Core\Constant;
12
use Requests;
13
14
/**
15
 * Class HTTPRequestFactory.
16
 *
17
 * @author Samuel Adeshina <[email protected]>
18
 *
19
 * @since v0.0.1 08/06/2016 14:20
20
 */
21
class HTTPRequestFactory
22
{
23
	private static $headers;
24
25
	public static function bootstrap()
26
	{
27
		$configJson = file_get_contents(Constant::getGlobals()["config-dir"]["http-headers-config"]);
28
29
        self::$headers = json_decode($configJson, true);
30
	}
31
32
	public static function get($url, $extraHeaders = [])
33
	{
34
		self::bootstrap();
35
36
		return Requests::get($url, array_merge(self::$headers, $extraHeaders));
37
	}
38
39
	public static function post($url, $data, $extraHeaders = [])
40
	{
41
		self::bootstrap();
42
43
		return Requests::post($url, array_merge(self::$headers, $extraHeaders), $data);
44
	}
45
}