Passed
Push — master ( e8502e...677200 )
by Stephen
24:48
created

NonTeamUsersQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 7 1
A builder() 0 3 1
1
<?php
2
3
namespace Sfneal\Users\Queries;
4
5
use Illuminate\Database\Eloquent\Builder;
6
use Illuminate\Database\Eloquent\Collection;
7
use Sfneal\Queries\Query;
8
use Sfneal\Users\Builders\UserBuilder;
9
use Sfneal\Users\Models\User;
10
11
class NonTeamUsersQuery extends Query
12
{
13
    /**
14
     * Retrieve a Query builder.
15
     *
16
     * @return UserBuilder
17
     */
18
    protected function builder(): UserBuilder
19
    {
20
        return User::query()->withInactive();
21
    }
22
23
    /**
24
     * Retrieve a Collection of User's who are NOT team members.
25
     *
26
     * @return Collection
27
     */
28
    public function execute()
29
    {
30
        return $this->builder()
31
            ->doesntHave('team')
32
            ->orderBy('last_name', 'asc')
0 ignored issues
show
Bug introduced by
The method orderBy() does not exist on Sfneal\Users\Builders\UserBuilder. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
            ->/** @scrutinizer ignore-call */ orderBy('last_name', 'asc')
Loading history...
33
            ->orderBy('first_name', 'asc')
34
            ->get();
35
    }
36
}
37