Passed
Push — master ( 0deb8f...f54565 )
by Goffy
04:13
created

Configuration   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 3 2
A __construct() 0 5 1
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
	 * @return Configuration
40
	 */
41
	public static function fromArray(array $conf)
42
	{
43
		return new static($conf['clientId'], $conf['clientSecret'], isset($conf['scopes']) ? $conf['scopes'] : []);
44
	}
45
46
}
47