Factory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 6
Bugs 1 Features 0
Metric Value
wmc 3
c 6
b 1
f 0
lcom 0
cbo 4
dl 0
loc 26
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 16 3
1
<?php
2
3
namespace Analogue\ORM\System\Wrappers;
4
5
use Analogue\ORM\Mappable;
6
use Analogue\ORM\System\Manager;
7
8
class Factory
9
{
10
    /**
11
     * Build the wrapper corresponding to the object's type
12
     *
13
     * @param  mixed $object
14
     * @throws \Analogue\ORM\Exceptions\MappingException
15
     * @return Wrapper
16
     */
17
    public function make($object)
18
    {
19
        $manager = Manager::getInstance();
20
21
        if ($manager->isValueObject($object)) {
22
            $entityMap = $manager->getValueMap($object);
23
        } else {
24
            $entityMap = $manager->mapper($object)->getEntityMap();
25
        }
26
27
        if ($object instanceof Mappable) {
28
            return new EntityWrapper($object, $entityMap);
29
        } else {
30
            return new PlainObjectWrapper($object, $entityMap);
31
        }
32
    }
33
}
34