Completed
Pull Request — master (#267)
by
unknown
11:00
created

Config   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 8
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __clone() 0 3 1
A getInstance() 0 7 2
A __get() 0 8 2
A __set() 0 7 2
1
<?php
2
namespace QiniuRtc;
3
4
final class Config
5
{
6
    const SDK_VERSION = '1.0.0';
7
    const SDK_USER_AGENT = 'Rtc-sdk-php';
8
9
    public $USE_HTTPS = false;
10
11
    public $RTCAPI_HOST = 'http://rtc.qiniuapi.com';
12
    public $RTCAPI_VERSION = 'v3';   //连麦版本号
13
14
    protected static $_instance = null;
15
16
    protected function __construct()
17
    {
18
    }
19
20
    protected function __clone()
21
    {
22
    }
23
24
    public static function getInstance()
25
    {
26
        if (!(self::$_instance instanceof self)) {
27
            self::$_instance = new self();
28
        }
29
        return self::$_instance;
30
    }
31
32
    public function __get($property)
33
    {
34
        if (property_exists(self::getInstance(), $property)) {
35
            return self::getInstance()->$property;
36
        } else {
37
            return null;
38
        }
39
    }
40
41
    public function __set($property, $value)
42
    {
43
        if (property_exists(self::getInstance(), $property)) {
44
            self::getInstance()->$property = $value;
45
        }
46
        return self::getInstance();
47
    }
48
}
49