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 pathAccountType.php
74 lines (66 loc) · 2.12 KB
/
AccountType.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
<?php
Class CostType {
var $currency;
var $monthly;
/**
*
* @param <string> $currency
* @param <integer> $monthly
*/
public function CostType($currency, $monthly) {
$this->currency = $currency;
$this->monthly = $monthly;
}
}
Class RightsType {
var $borderless;
var $searchEnhancer;
public function RightsType($borderless, $searchEnhancer) {
$this->borderless = $borderless;
$this->searchEnhancer = $searchEnhancer;
}
}
class AccountType {
var $version;
var $accountId;
var $title;
var $cost;
var $bandwidth;
var $rights;
///////////////////////////////////////////////////////////////////////////
/**
* Package protected constructor.
*
* @param version the vzaar API version number
* @param accountId the vzaar account ID
* @param title the name of the vzaar account
* @param monthly the monthly cost of the account in the given currency
* @param currency the currency the account is charged in. Currently this
* is only in dollars
* @param bandwidth the amount of monthly bandwidth allocated to a user
* for video service and playing
* @param borderless if the user is allowed to use a player with no skin
* @param searchEnhancer if the user is allowed to optimize where google
* directs video traffic
*/
public function AccountType($version, $accountId, $title, $monthly, $currency, $bandwidth, $borderless, $searchEnhancer) {
$this->version = $version;
$this->accountId = $accountId;
$this->title = $title;
$this->cost = new CostType($currency, $monthly);
$this->rights = new RightsType($borderless, $searchEnhancer);
$this->bandwidth = $bandwidth;
}
static function fromJson($data) {
$jo = json_decode($data);
if ($jo==NULL) {
return NULL;
}
else {
//$version, $accountId, $title, $monthly, $currency, $bandwidth, $borderless, $searchEnhancer
$acc = new AccountType($jo->version, $jo->account_id, $jo->title, $jo->cost->monthly, $jo->cost->currency, $jo->bandwidth, $jo->rights->borderless, $jo->rights->searchEnhancer);
return $acc;
}
}
}
?>