Passed
Push — master ( 0bc69d...cc8e66 )
by Stephen
56s queued 13s
created

TrackTrafficBuilder::whereEnvironmentDevelopment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Sfneal\Tracking\Builders;
4
5
use Sfneal\Builders\QueryBuilder;
6
use Sfneal\Users\Builders\Interfaces\WhereUserInterface;
7
use Sfneal\Users\Builders\Traits\WhereUser;
8
9
class TrackTrafficBuilder extends QueryBuilder implements WhereUserInterface
10
{
11
    use WhereUser;
12
13
    /**
14
     * Scope query results to Traffic sent to a particular endpoint $uri.
15
     *
16
     * @param string $uri
17
     * @param string $operator
18
     * @param string $boolean
19
     *
20
     * @return $this
21
     */
22
    public function whereRequestUri(string $uri, string $operator = '=', string $boolean = 'and')
23
    {
24
        $this->where('request_uri', $operator, $uri, $boolean);
25
26
        return $this;
27
    }
28
29
    /**
30
     * Add an 'or where' request_uri clause to the query.
31
     *
32
     * @param string $uri
33
     * @param string $operator
34
     *
35
     * @return $this
36
     */
37
    public function orWhereRequestUri(string $uri, string $operator = '=')
38
    {
39
        $this->whereRequestUri($uri, $operator, 'or');
40
41
        return $this;
42
    }
43
44
    /**
45
     * Scope query results to Traffic sent to an array of $uris.
46
     *
47
     * @param array  $uris
48
     * @param string $boolean
49
     * @param bool   $not
50
     *
51
     * @return $this
52
     */
53
    public function whereRequestUriIn(array $uris, string $boolean = 'and', bool $not = false)
54
    {
55
        $this->whereIn('request_uri', $uris, $boolean, $not);
0 ignored issues
show
Bug introduced by
The method whereIn() does not exist on Sfneal\Tracking\Builders\TrackTrafficBuilder. 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

55
        $this->/** @scrutinizer ignore-call */ 
56
               whereIn('request_uri', $uris, $boolean, $not);
Loading history...
56
57
        return $this;
58
    }
59
60
    /**
61
     * Add a where clause that scopes query results to Traffic originating in a particular app environment.
62
     *
63
     * @param string $environment
64
     * @param string $operator
65
     * @param string $boolean
66
     *
67
     * @return $this
68
     */
69
    public function whereEnvironment(string $environment, string $operator = '=', string $boolean = 'and')
70
    {
71
        $this->where('app_environment', $operator, $environment, $boolean);
72
73
        return $this;
74
    }
75
76
    /**
77
     * Scope query results to only Traffic originating from a 'production' environment.
78
     *
79
     * @return $this
80
     */
81
    public function whereEnvironmentProduction()
82
    {
83
        $this->whereEnvironment('production');
84
85
        return $this;
86
    }
87
88
    /**
89
     * Scope query results to only Traffic originating from a 'development' environment.
90
     *
91
     * @return $this
92
     */
93
    public function whereEnvironmentDevelopment()
94
    {
95
        $this->whereEnvironment('development');
96
97
        return $this;
98
    }
99
}
100