Configuration   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 8
c 1
b 1
f 0
dl 0
loc 32
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A fromArray() 0 3 2
1
<?php
2
3
namespace XoopsModules\Wggithub\Github\OAuth;
4
5
use XoopsModules\Wggithub\Github;
6
7
8
/**
9
 * Configuration for OAuth token obtaining.
10
 *
11
 * @author  Miloslav Hůla (https://github.com/milo)
12
 */
13
class Configuration extends Github\Sanity
14
{
15
    /** @var string */
16
    public $clientId;
17
18
    /** @var string */
19
    public $clientSecret;
20
21
    /** @var string[] */
22
    public $scopes;
23
24
25
    /**
26
     * @param  string
27
     * @param  string
28
     * @param  string[]
29
     */
30
    public function __construct($clientId, $clientSecret, array $scopes = [])
31
    {
32
        $this->clientId = $clientId;
33
        $this->clientSecret = $clientSecret;
34
        $this->scopes = $scopes;
35
    }
36
37
38
    /**
39
     * @param array $conf
40
     * @return Configuration
41
     */
42
    public static function fromArray(array $conf)
43
    {
44
        return new static($conf['clientId'], $conf['clientSecret'], isset($conf['scopes']) ? $conf['scopes'] : []);
45
    }
46
47
}
48