This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.php
93 lines (84 loc) · 2.65 KB
/
User.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* User's public details along with it's relevant metadata.
* @author Skitsanos
*/
require_once 'VzaarException.php';
class User
{
var $version;
var $authorName;
var $authorId;
var $authorUrl;
var $authorAccount;
var $createdAt;
var $videoCount;
var $playCount;
var $bandwidthThisMonth;
var $videosTotalSize;
static function fromJson($data)
{
$jo = json_decode($data);
print_r($jo);
if ($jo == NULL) {
throw new VzaarException('Object not found');
} else {
$user = new User();
$user->authorName = $jo->author_url;
$user->playCount = $jo->play_count;
$user->authorId = $jo->author_id;
$user->authorUrl = $jo->author_url;
$user->createdAt = $jo->created_at;
$user->authorAccount = $jo->author_account;
$user->videoCount = $jo->video_count;
$user->version = $jo->version;
return $user;
}
}
/**
* Package protected constructor.
*
* @param version the vzaar API version number.
* @param authorName the vzaar user name (i.e. their login)
* @param authorId the vzaar user id
* @param authorUrl a link to the vzaar user summary page
* @param authorAccount a number representing the users vzaar
* account. 1 represents a free account
* @param createdAt the date time the video was uploaded. Will be
* in UTC format
* @param videoCount the number of active videos in the users
* account
* @param playCount the number of times all the users videos
* have been played
*/
function __construct()
{
}
function __construct1($version, $authorName, $authorId, $authorUrl, $authorAccount, $createdAt, $videoCount, $playCount)
{
$this->version = $version;
$this->authorName = $authorName;
$this->authorId = $authorId;
$this->authorUrl = $authorUrl;
$this->authorAccount = $authorAccount;
$this->createdAt = $createdAt;
$this->videoCount = $videoCount;
$this->playCount = $playCount;
}
/**
* String representation of the user bean.
*/
public function toString()
{
return
"version=" . $this->version .
", authorName=" . $this->authorName .
", authorId=" . $this->authorId .
", authorUrl=" . $this->authorUrl .
", authorAccount=" . $this->authorAccount .
", createdAt=" . $this->createdAt .
", videoCount=" . $this->videoCount .
", playCount=" . $this->playCount;
}
}
?>