Passed
Push — master ( 9f58b4...83392d )
by Rougin
03:13
created

OneToOne   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 8 1
1
<?php
2
3
namespace Rougin\Windstorm\Relation;
4
5
use Rougin\Windstorm\RelationInterface;
6
7
/**
8
 * One-To-One Relation
9
 *
10
 * @package Windstorm
11
 * @author  Rougin Gutib <[email protected]>
12
 */
13
class OneToOne extends Relation implements RelationInterface
14
{
15
    /**
16
     * Generates the query instance from relation.
17
     *
18
     * @param  string $primary
19
     * @param  string $foreign
20
     * @return \Rougin\Windstorm\QueryInterface
21
     */
22 3
    public function make($primary, $foreign)
23
    {
24 3
        $fields = array_merge($this->columns(0), $this->columns(1));
25
26 3
        $query = $this->query;
27
28 3
        return $query->select($fields)->from($this->primary, $this->alias[0])
29 3
            ->innerJoin($this->foreign, $primary, $foreign);
30
    }
31
}
32