Total Complexity | 7 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | class JWTOptions |
||
9 | { |
||
10 | /** |
||
11 | * @var array |
||
12 | */ |
||
13 | protected $jwt=array( |
||
14 | 'using' => false, |
||
15 | 'UAPAY_pubkey' => '', |
||
16 | 'our_privkey' => '', |
||
17 | ); |
||
18 | |||
19 | /** |
||
20 | * Constructor |
||
21 | * |
||
22 | * @param array $options array of options |
||
23 | * @throws Exception\Data |
||
24 | */ |
||
25 | public function __construct($options) |
||
26 | { |
||
27 | if (isset($options['jwt'])) |
||
28 | { |
||
29 | // using |
||
30 | if ( ! isset($options['jwt']['using'])) |
||
31 | { |
||
32 | throw new Exception\Data('parameter jwt/using is not specified'); |
||
33 | } |
||
34 | if ( ! is_bool($options['jwt']['using'])) |
||
35 | { |
||
36 | throw new Exception\Data('parameter jwt/using is incorrect'); |
||
37 | } |
||
38 | // using |
||
39 | if ( ! isset($options['jwt']['UAPAY_pubkey'])) |
||
40 | { |
||
41 | throw new Exception\Data('parameter jwt/UAPAY_pubkey is not specified'); |
||
42 | } |
||
43 | // using |
||
44 | if ( ! isset($options['jwt']['our_privkey'])) |
||
45 | { |
||
46 | throw new Exception\Data('parameter jwt/our_privkey is not specified'); |
||
47 | } |
||
48 | |||
49 | $this->jwt = $options['jwt']; |
||
50 | } |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Get jwt options |
||
55 | * |
||
56 | * @return array |
||
57 | */ |
||
58 | public function get() |
||
61 | } |
||
62 | } |
||
63 |