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 GraphUser 28 * 29 * @package Facebook 30 */ 31class GraphUser extends GraphNode 32{ 33 /** 34 * @var array Maps object key names to Graph object types. 35 */ 36 protected static $graphObjectMap = [ 37 'hometown' => '\Facebook\GraphNodes\GraphPage', 38 'location' => '\Facebook\GraphNodes\GraphPage', 39 'significant_other' => '\Facebook\GraphNodes\GraphUser', 40 'picture' => '\Facebook\GraphNodes\GraphPicture', 41 ]; 42 43 /** 44 * Returns the ID for the user as a string if present. 45 * 46 * @return string|null 47 */ 48 public function getId() 49 { 50 return $this->getField('id'); 51 } 52 53 /** 54 * Returns the name for the user as a string if present. 55 * 56 * @return string|null 57 */ 58 public function getName() 59 { 60 return $this->getField('name'); 61 } 62 63 /** 64 * Returns the first name for the user as a string if present. 65 * 66 * @return string|null 67 */ 68 public function getFirstName() 69 { 70 return $this->getField('first_name'); 71 } 72 73 /** 74 * Returns the middle name for the user as a string if present. 75 * 76 * @return string|null 77 */ 78 public function getMiddleName() 79 { 80 return $this->getField('middle_name'); 81 } 82 83 /** 84 * Returns the last name for the user as a string if present. 85 * 86 * @return string|null 87 */ 88 public function getLastName() 89 { 90 return $this->getField('last_name'); 91 } 92 93 /** 94 * Returns the email for the user as a string if present. 95 * 96 * @return string|null 97 */ 98 public function getEmail() 99 { 100 return $this->getField('email'); 101 } 102 103 /** 104 * Returns the gender for the user as a string if present. 105 * 106 * @return string|null 107 */ 108 public function getGender() 109 { 110 return $this->getField('gender'); 111 } 112 113 /** 114 * Returns the Facebook URL for the user as a string if available. 115 * 116 * @return string|null 117 */ 118 public function getLink() 119 { 120 return $this->getField('link'); 121 } 122 123 /** 124 * Returns the users birthday, if available. 125 * 126 * @return Birthday|null 127 */ 128 public function getBirthday() 129 { 130 return $this->getField('birthday'); 131 } 132 133 /** 134 * Returns the current location of the user as a GraphPage. 135 * 136 * @return GraphPage|null 137 */ 138 public function getLocation() 139 { 140 return $this->getField('location'); 141 } 142 143 /** 144 * Returns the current location of the user as a GraphPage. 145 * 146 * @return GraphPage|null 147 */ 148 public function getHometown() 149 { 150 return $this->getField('hometown'); 151 } 152 153 /** 154 * Returns the current location of the user as a GraphUser. 155 * 156 * @return GraphUser|null 157 */ 158 public function getSignificantOther() 159 { 160 return $this->getField('significant_other'); 161 } 162 163 /** 164 * Returns the picture of the user as a GraphPicture 165 * 166 * @return GraphPicture|null 167 */ 168 public function getPicture() 169 { 170 return $this->getField('picture'); 171 } 172} 173