KeyManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 23
rs 10
c 0
b 0
f 0
ccs 12
cts 12
cp 1
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A GetServerKey() 0 5 2
A __construct() 0 10 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
}