MapperFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 1
c 3
b 1
f 1
lcom 0
cbo 0
dl 0
loc 19
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 1
1
<?php
2
3
namespace GFG\Mapper\Data;
4
5
/**
6
 * Creates a given type of mapper
7
 */
8
class MapperFactory
9
{
10
    /**
11
     * @param Manager $manager
12
     * @param string $type
13
     * @param MapperInterface $mapper
14
     * @param array $options
15
     */
16 1
    public function create(
17
        Manager $manager,
18
        $type,
19
        MapperInterface $mapper,
20
        array $options
21
    ) {
22 1
        $name = str_replace(' ', '\\', ucwords(str_replace('-', ' ', $type)));
23 1
        $class = __NAMESPACE__ . "\\Type\\$name";
24 1
        return new $class($manager, $mapper, $options);
25
    }
26
}
27