QwatchersAbstract::queryApplies()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
1
<?php namespace Maqe\Qwatcher;
2
3
use Illuminate\Database\Eloquent\Builder;
4
5
abstract class QwatchersAbstract
6
{
7
    protected $statusable = [];
8
9
    protected $queryable = [];
10
11
    protected $sortColumn = '';
12
13
    protected $sortOrder = '';
14
15
    protected $sortable = [];
16
17
    protected $limit = null;
18
19
    /**
20
     * Apply available condition from bilder
21
     *
22
     * @param  Builder $builder The tracks builder
23
     * @return Builder
24
     */
25
    protected function queryApplies(Builder $builder)
26
    {
27
        foreach ($this->queryable as $query) {
28
            $methodName = 'apply'.ucfirst($query);
29
30
            if (method_exists($this, $methodName)) {
31
                $this->{$methodName}($builder);
32
            }
33
        }
34
    }
35
}
36