Completed
Push — master ( dbd6b1...1c86dd )
by Jared
04:09
created

HasMany::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * @author Jared King <[email protected]>
5
 *
6
 * @link http://jaredtking.com
7
 *
8
 * @copyright 2015 Jared King
9
 * @license MIT
10
 */
11
namespace Pulsar\Relation;
12
13
class HasMany extends Relation
14
{
15 View Code Duplication
    protected function initQuery()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
    {
17
        $localKey = $this->localKey;
18
        $value = $this->relation->$localKey;
19
20
        if ($value === null) {
21
            $this->empty = true;
22
        }
23
24
        $this->query->where($this->foreignKey, $value);
25
    }
26
27
    public function getResults()
28
    {
29
        if ($this->empty) {
30
            return;
31
        }
32
33
        return $this->query->execute();
34
    }
35
36
    public function create(array $values = [])
37
    {
38
        // TODO
39
    }
40
}
41