Passed
Push — master ( 31bb1c...730203 )
by Ryosuke
01:52
created

EloquentHasByNonDependentSubqueryServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 29
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 23 1
1
<?php
2
3
namespace Mpyw\EloquentHasByNonDependentSubquery;
4
5
use Illuminate\Database\Eloquent\Builder;
6
use Illuminate\Support\ServiceProvider;
7
8
class EloquentHasByNonDependentSubqueryServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Register Eloquent\Builder::hasByNonDependentSubquery() macros.
12
     */
13 23
    public function boot(): void
14
    {
15
        Builder::macro('hasByNonDependentSubquery', function (...$args) {
0 ignored issues
show
Bug introduced by
The method macro() does not seem to exist on object<Illuminate\Database\Eloquent\Builder>.

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...
16
            /** @var \Illuminate\Database\Eloquent\Builder $query */
17 20
            $query = $this;
18 20
            return (new HasByNonDependentSubqueryMacro($query))->has(...$args);
19 23
        });
20
        Builder::macro('orHasByNonDependentSubquery', function (...$args) {
0 ignored issues
show
Bug introduced by
The method macro() does not seem to exist on object<Illuminate\Database\Eloquent\Builder>.

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...
21
            /** @var \Illuminate\Database\Eloquent\Builder $query */
22 1
            $query = $this;
23 1
            return (new HasByNonDependentSubqueryMacro($query))->orHas(...$args);
24 23
        });
25
        Builder::macro('doesntHaveByNonDependentSubquery', function (...$args) {
0 ignored issues
show
Bug introduced by
The method macro() does not seem to exist on object<Illuminate\Database\Eloquent\Builder>.

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...
26
            /** @var \Illuminate\Database\Eloquent\Builder $query */
27 1
            $query = $this;
28 1
            return (new HasByNonDependentSubqueryMacro($query))->doesntHave(...$args);
29 23
        });
30
        Builder::macro('orDoesntHaveByNonDependentSubquery', function (...$args) {
0 ignored issues
show
Bug introduced by
The method macro() does not seem to exist on object<Illuminate\Database\Eloquent\Builder>.

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...
31
            /** @var \Illuminate\Database\Eloquent\Builder $query */
32 1
            $query = $this;
33 1
            return (new HasByNonDependentSubqueryMacro($query))->orDoesntHave(...$args);
34 23
        });
35
    }
36
}
37