TroughRelation   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
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