DirectRelation   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
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 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 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 relation
18
 *
19
 * @author  Michal Wachowski <[email protected]>
20
 * @package Moss\Storage
21
 */
22
class DirectRelation extends AbstractRelation
23
{
24
    use NormalizeNamespaceTrait;
25
26
    /**
27
     * Constructor
28
     *
29
     * @param string      $entity
30
     * @param array       $keys
31
     * @param null|string $container
32
     */
33
    public function __construct($entity, array $keys, $container = null)
34
    {
35
        $this->entity = $this->normalizeNamespace($entity);
36
        $this->container = $this->containerName($container);
37
38
        $this->assertKeys($keys);
39
40
        $this->assignKeys($keys, $this->keys);
41
        $this->in = array_keys($this->keys);
42
        $this->out = array_values($this->keys);
43
    }
44
}
45