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.

ElasticSearchClientFactory::bootstrap()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
13
/**
14
 * Class DatabaseConnectionFactory.
15
 * Instantiates a new instance of ConnectableInterface
16
 *
17
 * @author Samuel Adeshina <[email protected]>
18
 *
19
 * @since v0.0.1 08/06/2016 14:20
20
 */
21
class ElasticSearchClientFactory
22
{
23
	private static $clientObject;
24
25
	public static function bootstrap()
26
	{
27
		$configJson = file_get_contents(Constant::getGlobals()["config-dir"]["elasticsearch-config"]);
28
29
        $config = json_decode($configJson, true);
30
31
        self::$clientObject = \Elasticsearch\ClientBuilder::create()->setHosts($config["hosts"])->build();
32
	}
33
34
	public static function getClient()
35
	{
36
		self::bootstrap();
37
		return self::$clientObject;
38
	}
39
}