1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright 2017 Facebook, Inc. |
4
|
|
|
* |
5
|
|
|
* You are hereby granted a non-exclusive, worldwide, royalty-free license to |
6
|
|
|
* use, copy, modify, and distribute this software in source code or binary |
7
|
|
|
* form for use in connection with the web services and APIs provided by |
8
|
|
|
* Facebook. |
9
|
|
|
* |
10
|
|
|
* As with any software that integrates with the Facebook platform, your use |
11
|
|
|
* of this software is subject to the Facebook Developer Principles and |
12
|
|
|
* Policies [http://developers.facebook.com/policy/]. This copyright notice |
13
|
|
|
* shall be included in all copies or substantial portions of the software. |
14
|
|
|
* |
15
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
20
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21
|
|
|
* DEALINGS IN THE SOFTWARE. |
22
|
|
|
*/ |
23
|
|
|
namespace Facebook\GraphNode; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @package Facebook |
27
|
|
|
*/ |
28
|
|
|
class GraphPage extends GraphNode |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* @var array maps object key names to Graph object types |
32
|
|
|
*/ |
33
|
|
|
protected static $graphNodeMap = [ |
34
|
|
|
'best_page' => GraphPage::class, |
35
|
|
|
'global_brand_parent_page' => GraphPage::class, |
36
|
|
|
'location' => GraphLocation::class, |
37
|
|
|
'cover' => GraphCoverPhoto::class, |
38
|
|
|
'picture' => GraphPicture::class, |
39
|
|
|
]; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Returns the ID for the user's page as a string if present. |
43
|
|
|
* |
44
|
|
|
* @return null|string |
45
|
|
|
*/ |
46
|
|
|
public function getId() |
47
|
|
|
{ |
48
|
|
|
return $this->getField('id'); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Returns the Category for the user's page as a string if present. |
53
|
|
|
* |
54
|
|
|
* @return null|string |
55
|
|
|
*/ |
56
|
|
|
public function getCategory() |
57
|
|
|
{ |
58
|
|
|
return $this->getField('category'); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Returns the Name of the user's page as a string if present. |
63
|
|
|
* |
64
|
|
|
* @return null|string |
65
|
|
|
*/ |
66
|
|
|
public function getName() |
67
|
|
|
{ |
68
|
|
|
return $this->getField('name'); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Returns the best available Page on Facebook. |
73
|
|
|
* |
74
|
|
|
* @return null|GraphPage |
75
|
|
|
*/ |
76
|
1 |
|
public function getBestPage() |
77
|
|
|
{ |
78
|
1 |
|
return $this->getField('best_page'); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Returns the brand's global (parent) Page. |
83
|
|
|
* |
84
|
|
|
* @return null|GraphPage |
85
|
|
|
*/ |
86
|
1 |
|
public function getGlobalBrandParentPage() |
87
|
|
|
{ |
88
|
1 |
|
return $this->getField('global_brand_parent_page'); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Returns the location of this place. |
93
|
|
|
* |
94
|
|
|
* @return null|GraphLocation |
95
|
|
|
*/ |
96
|
1 |
|
public function getLocation() |
97
|
|
|
{ |
98
|
1 |
|
return $this->getField('location'); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Returns CoverPhoto of the Page. |
103
|
|
|
* |
104
|
|
|
* @return null|GraphCoverPhoto |
105
|
|
|
*/ |
106
|
|
|
public function getCover() |
107
|
|
|
{ |
108
|
|
|
return $this->getField('cover'); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Returns Picture of the Page. |
113
|
|
|
* |
114
|
|
|
* @return null|GraphPicture |
115
|
|
|
*/ |
116
|
|
|
public function getPicture() |
117
|
|
|
{ |
118
|
|
|
return $this->getField('picture'); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Returns the page access token for the admin user. |
123
|
|
|
* |
124
|
|
|
* Only available in the `/me/accounts` context. |
125
|
|
|
* |
126
|
|
|
* @return null|string |
127
|
|
|
*/ |
128
|
|
|
public function getAccessToken() |
129
|
|
|
{ |
130
|
|
|
return $this->getField('access_token'); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Returns the roles of the page admin user. |
135
|
|
|
* |
136
|
|
|
* Only available in the `/me/accounts` context. |
137
|
|
|
* |
138
|
|
|
* @return null|array |
139
|
|
|
*/ |
140
|
|
|
public function getPerms() |
141
|
|
|
{ |
142
|
|
|
return $this->getField('perms'); |
143
|
|
|
} |
144
|
|
|
} |
145
|
|
|
|