KeyManager::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 10
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1
crap 1
1
<?php
2
3
namespace CSFCloud;
4
5
use CSFCloud\Exceptions\MissingServerKeyException;
6
7
class KeyManager {
8
9
    private $server_key = null;
10
    private $client_id = null;
11
    private $client_secret = null;
12
13 8
    public function __construct (array $options) {
14 8
        $options = array_merge([
15 8
            "key" => null,
16
            "client_id" => null,
17
            "client_secret" => null
18 8
        ], $options);
19
20 8
        $this->server_key = $options["key"];
21 8
        $this->client_id = $options["client_id"];
22 8
        $this->client_secret = $options["client_secret"];
23 8
    }
24
25 8
    public function GetServerKey () : string {
26 8
        if (!$this->server_key) {
27 2
            throw new MissingServerKeyException();
28
        }
29 6
        return $this->server_key;
30
    }
31
32
}