Passed
Push — master ( 4a474d...df1b75 )
by Stephen
02:14
created

RoleBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A whereType() 0 5 1
A whereTypeUser() 0 5 1
1
<?php
2
3
namespace Sfneal\Users\Builders;
4
5
use Sfneal\Builders\QueryBuilder;
6
7
class RoleBuilder extends QueryBuilder
8
{
9
    /**
10
     * Scope Role query to roles of a particular type.
11
     *
12
     * @param string $type
13
     * @param string $operator
14
     * @param string $boolean
15
     *
16
     * @return $this
17
     */
18
    public function whereType(string $type, string $operator = '=', string $boolean = 'and')
19
    {
20
        $this->where('type', $operator, $type, $boolean);
21
22
        return $this;
23
    }
24
25
    /**
26
     * Scope Role query to only 'user' type roles.
27
     *
28
     * @param string $operator
29
     * @param string $boolean
30
     *
31
     * @return $this
32
     */
33
    public function whereTypeUser(string $operator = '=', string $boolean = 'and')
34
    {
35
        $this->whereType('user', $operator, $boolean);
36
37
        return $this;
38
    }
39
}
40