Completed
Push — master ( 434411...5e8f86 )
by Tyler
05:44
created

ApiRebooter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 25
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
1
<?php
2
3
namespace Tylercd100\Rebooter\Drivers\Api;
4
5
use GuzzleHttp\Client;
6
use Tylercd100\Rebooter\Drivers\ServerController;
7
8
abstract class ApiRebooter implements ServerController
9
{
10
    protected $token;
11
    protected $server_id;
12
    protected $host;
13
    protected $client;
14
15
    /**
16
     * @param string $token     API Token
17
     * @param number $server_id The ID of the server
18
     * @param string $host      The api host
19
     * @param Client $client    The guzzle client to use
20
     */
21 36
    public function __construct($token, $server_id, $host, Client $client = null) {
22
23 36
        if (!$client instanceof Client) {
24 27
            $client = new Client();
25 27
        }
26
27 36
        $this->client = $client;
28 36
        $this->token = $token;
29 36
        $this->server_id = $server_id;
30 36
        $this->host = $host;
31
    }
32
}