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 */ 24namespace Facebook\GraphNodes; 25 26/** 27 * Class GraphPage 28 * 29 * @package Facebook 30 */ 31class GraphPage extends GraphNode 32{ 33 /** 34 * @var array Maps object key names to Graph object types. 35 */ 36 protected static $graphObjectMap = [ 37 'best_page' => '\Facebook\GraphNodes\GraphPage', 38 'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage', 39 'location' => '\Facebook\GraphNodes\GraphLocation', 40 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto', 41 'picture' => '\Facebook\GraphNodes\GraphPicture', 42 ]; 43 44 /** 45 * Returns the ID for the user's page as a string if present. 46 * 47 * @return string|null 48 */ 49 public function getId() 50 { 51 return $this->getField('id'); 52 } 53 54 /** 55 * Returns the Category for the user's page as a string if present. 56 * 57 * @return string|null 58 */ 59 public function getCategory() 60 { 61 return $this->getField('category'); 62 } 63 64 /** 65 * Returns the Name of the user's page as a string if present. 66 * 67 * @return string|null 68 */ 69 public function getName() 70 { 71 return $this->getField('name'); 72 } 73 74 /** 75 * Returns the best available Page on Facebook. 76 * 77 * @return GraphPage|null 78 */ 79 public function getBestPage() 80 { 81 return $this->getField('best_page'); 82 } 83 84 /** 85 * Returns the brand's global (parent) Page. 86 * 87 * @return GraphPage|null 88 */ 89 public function getGlobalBrandParentPage() 90 { 91 return $this->getField('global_brand_parent_page'); 92 } 93 94 /** 95 * Returns the location of this place. 96 * 97 * @return GraphLocation|null 98 */ 99 public function getLocation() 100 { 101 return $this->getField('location'); 102 } 103 104 /** 105 * Returns CoverPhoto of the Page. 106 * 107 * @return GraphCoverPhoto|null 108 */ 109 public function getCover() 110 { 111 return $this->getField('cover'); 112 } 113 114 /** 115 * Returns Picture of the Page. 116 * 117 * @return GraphPicture|null 118 */ 119 public function getPicture() 120 { 121 return $this->getField('picture'); 122 } 123 124 /** 125 * Returns the page access token for the admin user. 126 * 127 * Only available in the `/me/accounts` context. 128 * 129 * @return string|null 130 */ 131 public function getAccessToken() 132 { 133 return $this->getField('access_token'); 134 } 135 136 /** 137 * Returns the roles of the page admin user. 138 * 139 * Only available in the `/me/accounts` context. 140 * 141 * @return array|null 142 */ 143 public function getPerms() 144 { 145 return $this->getField('perms'); 146 } 147} 148