ORM::getClass()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Dolphin\Mapper;
4
5
use Dolphin\Utils\Table;
6
7
class ORM
8
{
9
    public static $class = null;
10
11
    public static function getClass()
12
    {
13
        if (null == self::$class) {
14
            self::$class = new Dolphin();
15
        }
16
17
        return self::$class;
18
    }
19
20
    public static function __callStatic($method, $parameters)
21
    {
22
        $calledClass = get_called_class();
23
        $object = self::getClass();
24
        $object->table = (new Table())->getTable($calledClass);
25
        $object->className = $calledClass;
26
27
        return $object->{$method}(...$parameters);
28
    }
29
30
    public function __call($method, $parameters)
31
    {
32
        if($method== 'asArray'){
33
            // $obj = new Utils();
34
        }
35
    }
36
}
37