Completed
Push — master ( 63fe9e...7c1db9 )
by Gerrit
02:35
created

ServiceMapping   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 55
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getServiceId() 0 4 1
A isLax() 0 4 1
A collectDBALColumns() 0 4 1
A describeOrigin() 0 4 1
1
<?php
2
/**
3
 * Copyright (C) 2018 Gerrit Addiks.
4
 * This package (including this file) was released under the terms of the GPL-3.0.
5
 * You should have received a copy of the GNU General Public License along with this program.
6
 * If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy.
7
 * @license GPL-3.0
8
 * @author Gerrit Addiks <[email protected]>
9
 */
10
11
namespace Addiks\RDMBundle\Mapping;
12
13
use Addiks\RDMBundle\Mapping\ServiceMappingInterface;
14
15
final class ServiceMapping implements ServiceMappingInterface
16
{
17
18
    /**
19
     * The service-id of the service to load for given entitiy-field.
20
     *
21
     * @var string
22
     */
23
    private $serviceId;
24
25
    /**
26
     * Set this to true if this field should not be checked for the correct service on persist.
27
     * This check is a safety-net and you should know what you are doing when you are disabling it.
28
     * You have been warned.
29
     *
30
     * @var bool
31
     */
32
    private $lax = false;
33
34
    /**
35
     * @var string
36
     */
37
    private $origin;
38
39 22
    public function __construct(
40
        string $serviceId,
41
        bool $lax = false,
42
        string $origin = "unknown"
43
    ) {
44 22
        $this->serviceId = $serviceId;
45 22
        $this->lax = $lax;
46 22
        $this->origin = $origin;
47 22
    }
48
49 5
    public function getServiceId(): string
50
    {
51 5
        return $this->serviceId;
52
    }
53
54 4
    public function isLax(): bool
55
    {
56 4
        return $this->lax;
57
    }
58
59 2
    public function describeOrigin(): string
60
    {
61 2
        return $this->origin;
62
    }
63
64 6
    public function collectDBALColumns(): array
65
    {
66 6
        return [];
67
    }
68
69
}
70