Passed
Push — main ( 3aa672...0dc4a1 )
by Proyecto
08:04
created

app()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3.0416

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 11
ccs 5
cts 6
cp 0.8333
rs 10
cc 3
nc 4
nop 1
crap 3.0416
1
<?php
2
3
4
if( ! function_exists("app") ){
5
    function app($alias = null){
6 71
        static $app = null;
7
8 71
        if( $app == null ){
9
            $app = new \League\Container\Container();
10
        }
11
12 71
        if( $alias != null )
13 31
            return $app->get($alias);
14
15 71
        return $app;
16
    }
17
18
    if( ! function_exists("getConcrete") ) {
19
        function getConcrete($entityManager): \ProyectoTAU\TAU\Common\Repository
20
        {
21
            $em_class = strstr($entityManager, '::', true);
22
            if ($em_class === false) {
23
                return new $entityManager;
24
            } else {
25
                return call_user_func(array($em_class, 'getInstance'));
26
            }
27
        }
28
    }
29
}
30