|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Stack Exchange Api Client library. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright (c) 2015 Beñat Espiña <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace BenatEspina\StackExchangeApiClient\Model\Traits; |
|
13
|
|
|
|
|
14
|
|
|
use BenatEspina\StackExchangeApiClient\Util\Util; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class ReputationChangeTrait. |
|
18
|
|
|
* |
|
19
|
|
|
* @author Beñat Espiña <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
trait ReputationChangeTrait |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* Reputation that changes in a day. |
|
25
|
|
|
* |
|
26
|
|
|
* @var int |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $day; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Reputation that changes in a month. |
|
32
|
|
|
* |
|
33
|
|
|
* @var int |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $month; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Reputation that changes in a quarter. |
|
39
|
|
|
* |
|
40
|
|
|
* @var int |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $quarter; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Reputation that changes in a week. |
|
46
|
|
|
* |
|
47
|
|
|
* @var int |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $week; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Reputation that changes in a year. |
|
53
|
|
|
* |
|
54
|
|
|
* @var int |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $year; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Sets reputation that changes in a day. |
|
60
|
|
|
* |
|
61
|
|
|
* @param int $day The reputation that changes in a day. |
|
62
|
|
|
* |
|
63
|
|
|
* @return $this self Object |
|
64
|
|
|
*/ |
|
65
|
|
|
public function setReputationChangeDay($day) |
|
66
|
|
|
{ |
|
67
|
|
|
$this->day = $day; |
|
68
|
|
|
|
|
69
|
|
|
return $this; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Gets reputation that changes in day. |
|
74
|
|
|
* |
|
75
|
|
|
* @return int |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getReputationChangeDay() |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->day; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Sets reputation that changes in a month. |
|
84
|
|
|
* |
|
85
|
|
|
* @param int $month The reputation that changes in a month. |
|
86
|
|
|
* |
|
87
|
|
|
* @return $this self Object |
|
88
|
|
|
*/ |
|
89
|
|
|
public function setReputationChangeMonth($month) |
|
90
|
|
|
{ |
|
91
|
|
|
$this->month = $month; |
|
92
|
|
|
|
|
93
|
|
|
return $this; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Gets reputation that changes in day. |
|
98
|
|
|
* |
|
99
|
|
|
* @return int |
|
100
|
|
|
*/ |
|
101
|
|
|
public function getReputationChangeMonth() |
|
102
|
|
|
{ |
|
103
|
|
|
return $this->month; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* Sets reputation that changes in a quarter. |
|
108
|
|
|
* |
|
109
|
|
|
* @param int $quarter The reputation that changes in a quarter. |
|
110
|
|
|
* |
|
111
|
|
|
* @return $this self Object |
|
112
|
|
|
*/ |
|
113
|
|
|
public function setReputationChangeQuarter($quarter) |
|
114
|
|
|
{ |
|
115
|
|
|
$this->quarter = $quarter; |
|
116
|
|
|
|
|
117
|
|
|
return $this; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Gets reputation that changes in day. |
|
122
|
|
|
* |
|
123
|
|
|
* @return int |
|
124
|
|
|
*/ |
|
125
|
|
|
public function getReputationChangeQuarter() |
|
126
|
|
|
{ |
|
127
|
|
|
return $this->quarter; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* Sets reputation that changes in a week. |
|
132
|
|
|
* |
|
133
|
|
|
* @param int $week The reputation that changes in a week. |
|
134
|
|
|
* |
|
135
|
|
|
* @return $this self Object |
|
136
|
|
|
*/ |
|
137
|
|
|
public function setReputationChangeWeek($week) |
|
138
|
|
|
{ |
|
139
|
|
|
$this->week = $week; |
|
140
|
|
|
|
|
141
|
|
|
return $this; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* Gets reputation that changes in day. |
|
146
|
|
|
* |
|
147
|
|
|
* @return int |
|
148
|
|
|
*/ |
|
149
|
|
|
public function getReputationChangeWeek() |
|
150
|
|
|
{ |
|
151
|
|
|
return $this->week; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* Sets reputation that changes in a year. |
|
156
|
|
|
* |
|
157
|
|
|
* @param int $year The reputation that changes in a year. |
|
158
|
|
|
* |
|
159
|
|
|
* @return $this self Object |
|
160
|
|
|
*/ |
|
161
|
|
|
public function setReputationChangeYear($year) |
|
162
|
|
|
{ |
|
163
|
|
|
$this->year = $year; |
|
164
|
|
|
|
|
165
|
|
|
return $this; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* Gets reputation that changes in day. |
|
170
|
|
|
* |
|
171
|
|
|
* @return int |
|
172
|
|
|
*/ |
|
173
|
|
|
public function getReputationChangeYear() |
|
174
|
|
|
{ |
|
175
|
|
|
return $this->year; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* Loads the variables if the data exist into resource. It works like a constructor. |
|
180
|
|
|
* |
|
181
|
|
|
* @param null|mixed[] $resource The resource |
|
182
|
|
|
*/ |
|
183
|
|
|
protected function loadReputationChange($resource) |
|
184
|
|
|
{ |
|
185
|
|
|
$this->day = Util::setIfIntegerExists($resource, 'reputation_change_day'); |
|
186
|
|
|
$this->month = Util::setIfIntegerExists($resource, 'reputation_change_month'); |
|
187
|
|
|
$this->quarter = Util::setIfIntegerExists($resource, 'reputation_change_quarter'); |
|
188
|
|
|
$this->week = Util::setIfIntegerExists($resource, 'reputation_change_week'); |
|
189
|
|
|
$this->year = Util::setIfIntegerExists($resource, 'reputation_change_year'); |
|
190
|
|
|
} |
|
191
|
|
|
} |
|
192
|
|
|
|