Completed
Branch master (411345)
by Rémi
11:20
created

MorphMany::initRelation()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Analogue\ORM\Relationships;
4
5
class MorphMany extends MorphOneOrMany
6
{
7
    /**
8
     * Get the results of the relationship.
9
     *
10
     * @param  $relation
11
     * @return mixed
12
     */
13
    public function getResults($relation)
14
    {
15
        $results = $this->query->get();
16
17
        $this->cacheRelation($results, $relation);
18
19
        return $results;
20
    }
21
22
    /**
23
     * Match the eagerly loaded results to their parents.
24
     *
25
     * @param  array            $results
26
     * @param  string           $relation
27
     * @return array
28
     */
29
    public function match(array $results, $relation)
30
    {
31
        return $this->matchMany($results, $relation);
32
    }
33
}
34