BypassConstructorEntityFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 16
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 6 1
1
<?php
2
3
namespace Cube\DoctrineEntityFactory;
4
5
/**
6
 * Instantiates a given entity bypassing it's constructor
7
 *
8
 * @author Gabriel Somoza <[email protected]>
9
 */
10
final class BypassConstructorEntityFactory implements EntityFactoryInterface
11
{
12
    /**
13
     * Gets an instance of the specified entity
14
     *
15
     * @param string $entityClassName
16
     *
17
     * @return object
18
     */
19 2
    public function get($entityClassName)
20
    {
21 2
        $klass = new \ReflectionClass($entityClassName);
22
23 2
        return $klass->newInstanceWithoutConstructor();
24
    }
25
}
26