QueryBuilderServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 2
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Database\Query\Builder;
6
use Illuminate\Support\ServiceProvider;
7
8
class QueryBuilderServiceProvider extends ServiceProvider
9
{
10
    public function boot()
11
    {
12
        Builder::macro('if', function (bool $condition, string $column, string $operator, $value) {
13
            if ($condition) {
14
                return $this->where($column, $operator, $value);
0 ignored issues
show
Bug introduced by
The method where() does not seem to exist on object<App\Providers\QueryBuilderServiceProvider>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
15
            }
16
17
            return $this;
18
        });
19
    }
20
}
21