Completed
Push — master ( 5da8f0...b74684 )
by Andrii
12:49
created

yii   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getApp() 0 4 2
A getContainer() 0 4 2
A createObject() 0 4 2
A getAlias() 0 4 2
A referenceTo() 0 4 2
1
<?php
2
3
namespace hiapi;
4
5
class yii {
6
    public static function getApp()
7
    {
8
        return class_exists('Yii') ? \Yii::$app : \yii\helpers\Yii::getApp();
9
    }
10
11
    public static function getContainer()
12
    {
13
        return class_exists('Yii') ? \Yii::$container : \yii\helpers\Yii::getContainer();
14
    }
15
16
    public static function createObject($class, $args)
17
    {
18
        return class_exists('Yii') ? \Yii::createObject($class, $args) : \yii\helpers\Yii::createObject($class, $args);
19
    }
20
21
    public static function getAlias($alias, $throwException = true)
22
    {
23
        return class_exists('Yii') ? \Yii::getAlias($alias, $throwException) : \yii\helpers\Yii::getAlias($alias, $throwException);
24
    }
25
26
    public static function referenceTo($id)
27
    {
28
        return class_exists('Yii') ? \yii\di\Instance::of($id) : \yii\di\Reference::to($id);
29
    }
30
}
31