AbstractMapper::map()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 8
Bugs 0 Features 0
Metric Value
c 8
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
namespace LaravelDoctrine\Fluent\Mappers;
4
5
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
6
use LaravelDoctrine\Fluent\Fluent;
7
use LaravelDoctrine\Fluent\Mapping;
8
9
abstract class AbstractMapper implements Mapper
10
{
11
    /**
12
     * @var Mapping
13
     */
14
    protected $mapping;
15
16
    /**
17
     * @param Mapping $mapping
18
     */
19 25
    public function __construct(Mapping $mapping)
20
    {
21 25
        $this->mapping = $mapping;
22 25
    }
23
24
    /**
25
     * @param Fluent $builder
26
     */
27 8
    public function map(Fluent $builder)
28
    {
29 8
        $this->setType($builder->getBuilder());
30
31 8
        $this->mapping->map($builder);
32
33 8
        $builder->build();
34 8
    }
35
36
    /**
37
     * @param ClassMetadataBuilder $metadata
38
     */
39 4
    protected function setType(ClassMetadataBuilder $metadata)
40
    {
41
        // By default nothing has to be done
42 4
    }
43
}
44