AbstractMapper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setType() 0 4 1
A map() 0 8 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