Completed
Push — master ( bf55ad...1b9783 )
by James Ekow Abaka
01:52
created

DefaultModelFactory::getModelTable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: ekow
5
 * Date: 9/5/17
6
 * Time: 7:51 AM
7
 */
8
9
namespace ntentan\nibii;
10
11
use ntentan\utils\Text;
12
13
class DefaultModelFactory implements ModelFactoryInterface
14
{
15
    public function createModel($className)
16
    {
17
        return new $className();
18
    }
19
20
    public function getModelTable($instance)
21
    {
22
        $class = new \ReflectionClass($instance);
23
        $nameParts = explode("\\", $class->getName());
24
        return \ntentan\utils\Text::deCamelize(end($nameParts));
25
    }
26
}