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

ApiRebooter::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
ccs 9
cts 9
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 4
crap 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
}