ORM::__callStatic()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 8
rs 10
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