|
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 Url |
|
19
|
|
|
* @package badams\GoogleUrl\Resources |
|
20
|
|
|
* @link https://developers.google.com/url-shortener/v1/url#resource |
|
21
|
|
|
*/ |
|
22
|
|
|
class Url extends Resource |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
public $kind = 'urlshortener#url'; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Short URL, e.g. "http://goo.gl/l6MS". |
|
31
|
|
|
* |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
public $id; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Long URL, e.g. "http://www.google.com/". |
|
38
|
|
|
* Might not be present if the status is "REMOVED". |
|
39
|
|
|
* |
|
40
|
|
|
* @var string|null |
|
41
|
|
|
*/ |
|
42
|
|
|
public $longUrl; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Status of the target URL. |
|
46
|
|
|
* |
|
47
|
|
|
* Possible values: "OK", "MALWARE", "PHISHING", or "REMOVED". |
|
48
|
|
|
* A URL might be marked "REMOVED" if it was flagged as spam, for example. |
|
49
|
|
|
* |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
public $status; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Time the short URL was created; ISO 8601 representation using the |
|
56
|
|
|
* yyyy-MM-dd'T'HH:mm:ss.SSSZZ format e.g. "2010-10-14T19:01:24.944+00:00". |
|
57
|
|
|
* |
|
58
|
|
|
* @var string|null |
|
59
|
|
|
*/ |
|
60
|
|
|
public $created; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* A summary of the click analytics for the short and long URL. |
|
64
|
|
|
* Might not be present if not requested or currently unavailable. |
|
65
|
|
|
* |
|
66
|
|
|
* @var Analytics|null |
|
67
|
|
|
*/ |
|
68
|
|
|
public $analytics; |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param \stdClass $json |
|
72
|
|
|
*/ |
|
73
|
3 |
|
public function setAnalytics($json) |
|
74
|
|
|
{ |
|
75
|
3 |
|
$this->analytics = Analytics::createFromJson($json); |
|
76
|
3 |
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|