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

Child::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
ccs 0
cts 5
cp 0
rs 10
cc 1
nc 1
nop 3
crap 2
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