Passed
Push — master ( 859fdf...61ca2a )
by Rougin
03:25
created

Child   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
c 0
b 0
f 0
dl 0
loc 46
ccs 0
cts 13
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A foreign() 0 3 1
A __construct() 0 7 1
A column() 0 3 1
1
<?php
2
3
namespace Rougin\Windstorm\Relation;
4
5
use Rougin\Windstorm\ChildInterface;
6
use Rougin\Windstorm\QueryInterface;
7
8
/**
9
 * Child
10
 *
11
 * @package Windstorm
12
 * @author  Rougin Gutib <[email protected]>
13
 */
14
class Child extends Wrappable implements ChildInterface
15
{
16
    /**
17
     * @var string
18
     */
19
    protected $column = '';
20
21
    /**
22
     * @var string
23
     */
24
    protected $foreign = '';
25
26
    /**
27
     * Initializes the child query instance.
28
     *
29
     * @param \Rougin\Windstorm\QueryInterface $query
30
     * @param string                           $foreign
31
     * @param string                           $column
32
     */
33
    public function __construct(QueryInterface $query, $foreign, $column)
34
    {
35
        parent::__construct($query);
36
37
        $this->column = $column;
38
39
        $this->foreign = $foreign;
40
    }
41
42
    /**
43
     * Returns the identifier column for identifying children from the parent table.
44
     *
45
     * @return string
46
     */
47
    public function column()
48
    {
49
        return $this->column;
50
    }
51
52
    /**
53
     * Returns the identifier column from the child table.
54
     *
55
     * @return string
56
     */
57
    public function foreign()
58
    {
59
        return $this->foreign;
60
    }
61
}
62