HttpClientFactory::getHttpClient()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0117

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
ccs 6
cts 7
cp 0.8571
rs 9.4286
cc 2
eloc 5
nc 2
nop 0
crap 2.0117
1
<?php
2
/**
3
 * @package: marx/php-self-updater
4
 *
5
 * @author:  msiebeneicher
6
 * @since:   2015-12-27
7
 *
8
 */
9
10
11
namespace PSU\HttpClient;
12
13
14
use GuzzleHttp\Client;
15
use PSU\HttpClient\Adapter\GuzzlApapter;
16
17
class HttpClientFactory
18
{
19
    /**
20
     * @var HttpClientInterface
21
     */
22
    private static $httpClient;
23
24
    /**
25
     * @return HttpClientInterface
26
     */
27 1
    public function getHttpClient()
28
    {
29 1
        if (self::$httpClient)
30 1
        {
31
            return self::$httpClient;
32
        }
33
34 1
        return self::$httpClient = new GuzzlApapter(
35 1
            new Client()
36 1
        );
37
    }
38
}