1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the badams\GoogleUrl library |
4
|
|
|
* |
5
|
|
|
* @license http://opensource.org/licenses/MIT |
6
|
|
|
* @link https://github.com/badams/google-url |
7
|
|
|
* @package badams/google-url |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
10
|
|
|
* file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace badams\GoogleUrl\Resources; |
14
|
|
|
|
15
|
|
|
use badams\GoogleUrl\Resource; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class Analytics |
19
|
|
|
* @package badams\GoogleUrl\Resources |
20
|
|
|
* @link https://developers.google.com/url-shortener/v1/url#resource |
21
|
|
|
*/ |
22
|
|
|
class Analytics extends Resource |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* |
26
|
|
|
*/ |
27
|
|
|
const FULL = 'FULL'; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* |
31
|
|
|
*/ |
32
|
|
|
const TOP = 'ANALYTICS_TOP_STRINGS'; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* |
36
|
|
|
*/ |
37
|
|
|
const CLICKS = 'ANALYTICS_CLICKS'; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Click analytics for all time |
41
|
|
|
* |
42
|
|
|
* @var Period |
43
|
|
|
*/ |
44
|
|
|
public $allTime; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Click analytics over the last month. |
48
|
|
|
* |
49
|
|
|
* @var Period |
50
|
|
|
*/ |
51
|
|
|
public $month; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Click analytics over the last week. |
55
|
|
|
* |
56
|
|
|
* @var Period |
57
|
|
|
*/ |
58
|
|
|
public $week; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Click analytics over the last day. |
62
|
|
|
* |
63
|
|
|
* @var Period |
64
|
|
|
*/ |
65
|
|
|
public $day; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Click analytics over the last two hours. |
69
|
|
|
* |
70
|
|
|
* @var Period |
71
|
|
|
*/ |
72
|
|
|
public $twoHours; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Populate analytics for all time |
76
|
|
|
* |
77
|
|
|
* @param \stdClass $data |
78
|
|
|
*/ |
79
|
3 |
|
public function setAllTime(\stdClass $data) |
80
|
|
|
{ |
81
|
3 |
|
$this->allTime = Period::createFromJson($data); |
82
|
3 |
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Populate analytics for last month |
86
|
|
|
* |
87
|
|
|
* @param \stdClass $data |
88
|
|
|
*/ |
89
|
3 |
|
public function setMonth(\stdClass $data) |
90
|
|
|
{ |
91
|
3 |
|
$this->month = Period::createFromJson($data); |
92
|
3 |
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Populate analytics for last week |
96
|
|
|
* |
97
|
|
|
* @param \stdClass $data |
98
|
|
|
*/ |
99
|
3 |
|
public function setWeek(\stdClass $data) |
100
|
|
|
{ |
101
|
3 |
|
$this->week = Period::createFromJson($data); |
102
|
3 |
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Populate analytics for last day |
106
|
|
|
* |
107
|
|
|
* @param \stdClass $data |
108
|
|
|
*/ |
109
|
3 |
|
public function setDay(\stdClass $data) |
110
|
|
|
{ |
111
|
3 |
|
$this->day = Period::createFromJson($data); |
112
|
3 |
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Populate analytics for last two hours |
116
|
|
|
* |
117
|
|
|
* @param \stdClass $data |
118
|
|
|
*/ |
119
|
3 |
|
public function setTwoHours(\stdClass $data) |
120
|
|
|
{ |
121
|
3 |
|
$this->twoHours = Period::createFromJson($data); |
122
|
3 |
|
} |
123
|
|
|
} |
124
|
|
|
|