MapperFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 3
Bugs 1 Features 1
Metric Value
c 3
b 1
f 1
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 8
nc 1
nop 4
crap 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