Issues (28)

src/Builders/TrackTrafficBuilder.php (1 issue)

Labels
Severity
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
     * @return $this
20
     */
21
    public function whereRequestUri(string $uri, string $operator = '=', string $boolean = 'and'): self
22
    {
23
        $this->where('request_uri', $operator, $uri, $boolean);
24
25
        return $this;
26
    }
27
28
    /**
29
     * Add an 'or where' request_uri clause to the query.
30
     *
31
     * @param  string  $uri
32
     * @param  string  $operator
33
     * @return $this
34
     */
35
    public function orWhereRequestUri(string $uri, string $operator = '='): self
36
    {
37
        $this->whereRequestUri($uri, $operator, 'or');
38
39
        return $this;
40
    }
41
42
    /**
43
     * Scope query results to Traffic sent to an array of $uris.
44
     *
45
     * @param  array  $uris
46
     * @param  string  $boolean
47
     * @param  bool  $not
48
     * @return $this
49
     */
50
    public function whereRequestUriIn(array $uris, string $boolean = 'and', bool $not = false): self
51
    {
52
        $this->whereIn('request_uri', $uris, $boolean, $not);
0 ignored issues
show
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

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