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

DefaultModelFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createModel() 0 4 1
A getModelTable() 0 6 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
}