Setters::period()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Awssat\Visits\Traits;
4
5
trait Setters
6
{
7
    /**
8
     * Return fresh cache from database
9
     * @return $this
10
     */
11
    public function fresh()
12
    {
13
        $this->fresh = true;
0 ignored issues
show
Bug Best Practice introduced by
The property fresh does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
14
15
        return $this;
16
    }
17
18
    /**
19
     * set x seconds for ip expiration
20
     *
21
     * @param $seconds
22
     * @return $this
23
     */
24
    public function seconds($seconds)
25
    {
26
        $this->ipSeconds = $seconds;
0 ignored issues
show
Bug Best Practice introduced by
The property ipSeconds does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
27
28
        return $this;
29
    }
30
31
32
    /**
33
     * @param $country
34
     * @return $this
35
     */
36
    public function country($country)
37
    {
38
        $this->country = $country;
0 ignored issues
show
Bug Best Practice introduced by
The property country does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
39
40
        return $this;
41
    }
42
43
44
    /**
45
     * @param $referer
46
     * @return $this
47
     */
48
    public function referer($referer)
49
    {
50
        $this->referer = $referer;
0 ignored issues
show
Bug Best Practice introduced by
The property referer does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
51
52
        return $this;
53
    }
54
55
    /**
56
     * @param $operatingSystem
57
     * @return $this
58
     */
59
    public function operatingSystem($operatingSystem)
60
    {
61
        $this->operatingSystem = $operatingSystem;
0 ignored issues
show
Bug Best Practice introduced by
The property operatingSystem does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
62
63
        return $this;
64
    }
65
66
    /**
67
     * @param $language
68
     * @return $this
69
     */
70
    public function language($language)
71
    {
72
        $this->language = $language;
0 ignored issues
show
Bug Best Practice introduced by
The property language does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
73
74
        return $this;
75
    }
76
77
    /**
78
     * Change period
79
     *
80
     * @param $period
81
     * @return $this
82
     */
83
    public function period($period)
84
    {
85
        if (in_array($period, $this->periods)) {
86
            $this->keys->visits = $this->keys->period($period);
87
        }
88
89
        return $this;
90
    }
91
}
92