ApiAlias::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: lenovo
5
 * Date: 6/23/2018
6
 * Time: 8:13 PM
7
 */
8
9
namespace TimSDK\Core;
10
11
use TimSDK\Support\Collection;
12
13
class ApiAlias extends Collection
14
{
15 3
    public function __construct()
16
    {
17 3
        $reflectionObject = new \ReflectionClass(API::class);
18 3
        parent::__construct($reflectionObject->getConstants());
19 3
    }
20
21 3
    public function get($key, $default = null)
22
    {
23 3
        $value = parent::get($key, $default);
24
25 3
        return is_null($value) ? $key : $value;
26
    }
27
28 3
    public function offsetGet($offset)
29
    {
30 3
        return $this->get($offset);
31
    }
32
}
33