WithCriteria::apply()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Ablunier\Laravel\Database\Repository\Eloquent\Criteria;
4
5
use Ablunier\Laravel\Database\Contracts\Repository\Criteria;
6
use Ablunier\Laravel\Database\Contracts\Repository\Repository;
7
8
class WithCriteria implements Criteria
9
{
10
    protected $with = [];
11 3
12
    public function __construct(array $with)
13 3
    {
14 3
        $this->with = $with;
15
    }
16 1
17
    public function apply($model, Repository $repository)
18 1
    {
19
        return $model->with($this->with);
20
    }
21
}
22