Passed
Push — master ( 356755...14835f )
by Gerrit
04:25
created

ListMapping::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 3
crap 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
 *
8
 * @license GPL-3.0
9
 *
10
 * @author Gerrit Addiks <[email protected]>
11
 */
12
13
namespace Addiks\RDMBundle\Mapping;
14
15
use Addiks\RDMBundle\Mapping\ListMappingInterface;
16
use Doctrine\DBAL\Schema\Column;
17
use Webmozart\Assert\Assert;
18
19
final class ListMapping implements ListMappingInterface
20
{
21
22
    /**
23
     * @var Column
24
     */
25
    private $column;
26
27
    /**
28
     * @var MappingInterface
29
     */
30
    private $entryMapping;
31
32
    /**
33
     * @var string
34
     */
35
    private $origin;
36
37 5
    public function __construct(
38
        Column $column,
39
        MappingInterface $entryMapping,
40
        string $origin = "unknown"
41
    ) {
42 5
        $this->column = $column;
43 5
        $this->entryMapping = $entryMapping;
44 5
        $this->origin = $origin;
45 5
    }
46
47 1
    public function getDBALColumn(): Column
48
    {
49 1
        return $this->column;
50
    }
51
52 1
    public function getEntryMapping(): MappingInterface
53
    {
54 1
        return $this->entryMapping;
55
    }
56
57 1
    public function describeOrigin(): string
58
    {
59 1
        return $this->origin;
60
    }
61
62 1
    public function collectDBALColumns(): array
63
    {
64
        /** @var array<Column> $dbalColumns */
65 1
        $dbalColumns = [$this->column];
66
67 1
        return $dbalColumns;
68
    }
69
70
}
71