GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

WhereHas   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 12
c 1
b 0
f 0
dl 0
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 0 17 2
1
<?php
2
3
namespace eloquentFilter\QueryFilter\Queries;
4
5
use Illuminate\Database\Eloquent\Builder;
6
7
/**
8
 * Class WhereHas.
9
 */
10
class WhereHas extends BaseClause
11
{
12
    /**
13
     * @param $query
14
     *
15
     * @return Builder
16
     */
17
    public function apply($query): Builder
18
    {
19
        $field_row = explode('.', $this->filter);
20
        $field_row = end($field_row);
21
22
        $conditions = str_replace('.'.$field_row, '', $this->filter);
23
24
        $value = $this->values;
25
26
        return $query->whereHas(
27
            $conditions,
28
            function ($q) use ($value, $field_row) {
29
                $condition = 'where';
30
                if (is_array($value)) {
31
                    $condition = 'whereIn';
32
                }
33
                $q->$condition($field_row, $value);
34
            }
35
        );
36
    }
37
}
38