Passed
Pull Request — 2.1 (#64)
by Vincent
11:26 queued 05:25
created

MapperFactory::createMapper()   B

Complexity

Conditions 8
Paths 33

Size

Total Lines 34
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 18
CRAP Score 8

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 34
ccs 18
cts 18
cp 1
rs 8.4444
c 0
b 0
f 0
cc 8
nc 33
nop 3
crap 8
1
<?php
2
3
namespace Bdf\Prime\Mapper;
4
5
use Bdf\Prime\Cache\CacheInterface;
6
use Bdf\Prime\Entity\Hydrator\MapperHydrator;
7
use Bdf\Prime\Entity\Hydrator\MapperHydratorInterface;
8
use Bdf\Prime\Mapper\NameResolver\ResolverInterface;
9
use Bdf\Prime\Mapper\NameResolver\SuffixResolver;
10
use Bdf\Prime\ServiceLocator;
11
use Psr\SimpleCache\CacheInterface as Psr16CacheInterface;
12
13
use function is_subclass_of;
14
use function str_replace;
15
16
/**
17
 * Default mapper factory
18
 * The mapper class will be resolved by the mapper name resolver, and instantiated by calling the constructor
19
 *
20
 * Will be marked as final in 3.0
21
 */
22
/*final*/ class MapperFactory extends AbstractMapperFactory
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 442
    protected function instantiateMapper(ServiceLocator $locator, string $mapperClass): Mapper
28
    {
29 442
        return new $mapperClass($locator);
30
    }
31
}
32