Vtu   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
dl 0
loc 51
ccs 6
cts 10
cp 0.6
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 8 2
A getResponse() 0 4 1
A getException() 0 4 1
A getUsername() 0 4 1
1
<?php
2
3
namespace Djunehor\Vtu\Concrete;
4
5
use Djunehor\Vtu\Contracts\VtuServiceInterface;
6
use GuzzleHttp\Client;
7
8
abstract class Vtu implements VtuServiceInterface
9
{
10
    protected $text;
11
    protected $username;
12
    protected $password;
13
    protected $recipients = [];
14
    private static $httpClient;
15
    protected $sender;
16
    protected $response;
17
    protected $client;
18
    protected $request;
19
20
    /**
21
     * @var \Exception
22
     */
23
    public $httpError;
24
25
    /**We want HTTP CLient instantiated
26
     * only once in entire app lifecycle
27
     * @return Client
28
     */
29 5
    public static function getInstance()
30
    {
31 5
        if (! self::$httpClient) {
32 5
            self::$httpClient = new Client();
33
        }
34
35 5
        return self::$httpClient;
36
    }
37
38
39
    /**We want HTTP CLient instantiated
40
     * only once in entire app lifecycle
41
     * @return string $response
42
     */
43
    public function getResponse() : string
44
    {
45
        return $this->response;
46
    }
47
48
    public function getException() : \Exception
49
    {
50
        return $this->httpError;
51
    }
52
53 2
    public function getUsername()
54
    {
55 2
        return $this->username;
56
    }
57
58
}
59