WithCountRelation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A apply() 0 4 1
1
<?php
2
3
namespace Napp\Core\Dbal\Criteria;
4
5
class WithCountRelation implements CriterionInterface
6
{
7
    protected $relations = [];
8
9
    public function __construct($relations = [])
10
    {
11
        $this->relations = $relations;
12
    }
13
14
    /**
15
     * @param \Illuminate\Database\Eloquent\Builder $query
16
     *
17
     * @return \Illuminate\Database\Eloquent\Builder|void
18
     */
19
    public function apply($query)
20
    {
21
        $query->withCount($this->relations);
22
    }
23
}
24