Passed
Push — master ( 6b0e6b...43789e )
by Stephen
03:30
created

TrackTrafficBuilder::whereEnvironmentProduction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
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 Domain\Users\Builders\Interfaces\WhereUserInterface;
0 ignored issues
show
Bug introduced by
The type Domain\Users\Builders\In...aces\WhereUserInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Domain\Users\Builders\Traits\WhereUser;
0 ignored issues
show
Bug introduced by
The type Domain\Users\Builders\Traits\WhereUser was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Sfneal\Builders\QueryBuilder;
8
9
// todo: add use of User package
10
class TrackTrafficBuilder extends QueryBuilder implements WhereUserInterface
11
{
12
    use WhereUser;
13
14
    /**
15
     * Scope query results to Traffic sent to a particular endpoint $uri.
16
     *
17
     * @param string $uri
18
     * @param string $operator
19
     * @param string $boolean
20
     *
21
     * @return $this
22
     */
23
    public function whereRequestUri(string $uri, string $operator = '=', string $boolean = 'and')
24
    {
25
        $this->where('request_uri', $operator, $uri, $boolean);
26
27
        return $this;
28
    }
29
30
    /**
31
     * Add an 'or where' request_uri clause to the query.
32
     *
33
     * @param string $uri
34
     * @param string $operator
35
     *
36
     * @return $this
37
     */
38
    public function orWhereRequestUri(string $uri, string $operator = '=')
39
    {
40
        $this->whereRequestUri($uri, $operator, 'or');
41
42
        return $this;
43
    }
44
45
    /**
46
     * Scope query results to Traffic sent to an array of $uris.
47
     *
48
     * @param array  $uris
49
     * @param string $boolean
50
     * @param bool   $not
51
     *
52
     * @return $this
53
     */
54
    public function whereRequestUriIn(array $uris, string $boolean = 'and', bool $not = false)
55
    {
56
        $this->whereIn('request_uri', $uris, $boolean, $not);
57
58
        return $this;
59
    }
60
61
    /**
62
     * Add a where clause that scopes query results to Traffic originating in a particular app environment.
63
     *
64
     * @param string $environment
65
     * @param string $operator
66
     * @param string $boolean
67
     *
68
     * @return $this
69
     */
70
    public function whereEnvironment(string $environment, string $operator = '=', string $boolean = 'and')
71
    {
72
        $this->where('app_environment', $operator, $environment, $boolean);
73
74
        return $this;
75
    }
76
77
    /**
78
     * Scope query results to only Traffic originating from a 'production' environment.
79
     *
80
     * @return $this
81
     */
82
    public function whereEnvironmentProduction()
83
    {
84
        $this->whereEnvironment('production');
85
86
        return $this;
87
    }
88
}
89