TroughRelation::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 8
nc 1
nop 5
1
<?php
2
3
/*
4
 * This file is part of the Storage package
5
 *
6
 * (c) Michal Wachowski <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Moss\Storage\Model\Definition\Relation;
13
14
use Moss\Storage\NormalizeNamespaceTrait;
15
16
/**
17
 * One to one trough mediator table (with pivot table)
18
 *
19
 * @author  Michal Wachowski <[email protected]>
20
 * @package Moss\Storage
21
 */
22
class TroughRelation extends AbstractRelation
23
{
24
    use NormalizeNamespaceTrait;
25
26
    /**
27
     * @param string      $entity
28
     * @param array       $in
29
     * @param array       $out
30
     * @param null|string $mediator
31
     * @param null|string $container
32
     */
33
    public function __construct($entity, array $in, array $out, $mediator, $container = null)
34
    {
35
        $this->entity = $this->normalizeNamespace($entity);
36
        $this->container = $this->containerName($container);
37
38
        $this->mediator = $this->normalizeNamespace($mediator);
39
40
        $this->assertTroughKeys($in, $out);
41
        $this->assignKeys($in, $this->in);
42
        $this->assignKeys($out, $this->out);
43
        $this->keys = array_combine(array_keys($this->in), array_values($this->out));
44
    }
45
}
46