Advertisement
Guest User

GraphUser.php from facebook php sdk

a guest
Mar 6th, 2015
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.41 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Copyright 2014 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.  */
  24. namespace Facebook;
  25.  
  26. /**
  27.  * Class GraphUser
  28.  * @package Facebook
  29.  * @author Fosco Marotto <fjm@fb.com>
  30.  * @author David Poll <depoll@fb.com>
  31.  */
  32. class GraphUser extends GraphObject
  33. {
  34.  
  35.   /**
  36.    * Returns the ID for the user as a string if present.
  37.    *
  38.    * @return string|null
  39.    */
  40.   public function getId()
  41.   {
  42.     return $this->getProperty('id');
  43.   }
  44.  
  45.   /**
  46.    * Returns the name for the user as a string if present.
  47.    *
  48.    * @return string|null
  49.    */
  50.   public function getName()
  51.   {
  52.     return $this->getProperty('name');
  53.   }
  54.  
  55.   public function getEmail()
  56.   {
  57.     return $this->getProperty('email');
  58.   }
  59.  
  60.   /**
  61.    * Returns the first name for the user as a string if present.
  62.    *
  63.    * @return string|null
  64.    */
  65.   public function getFirstName()
  66.   {
  67.     return $this->getProperty('first_name');
  68.   }
  69.  
  70.   /**
  71.    * Returns the middle name for the user as a string if present.
  72.    *
  73.    * @return string|null
  74.    */
  75.   public function getMiddleName()
  76.   {
  77.     return $this->getProperty('middle_name');
  78.   }
  79.  
  80.   /**
  81.    * Returns the last name for the user as a string if present.
  82.    *
  83.    * @return string|null
  84.    */
  85.   public function getLastName()
  86.   {
  87.     return $this->getProperty('last_name');
  88.   }
  89.  
  90.   /**
  91.    * Returns the gender for the user as a string if present.
  92.    *
  93.    * @return string|null
  94.    */
  95.   public function getGender()
  96.   {
  97.     return $this->getProperty('gender');
  98.   }
  99.  
  100.   /**
  101.    * Returns the Facebook URL for the user as a string if available.
  102.    *
  103.    * @return string|null
  104.    */
  105.   public function getLink()
  106.   {
  107.     return $this->getProperty('link');
  108.   }
  109.  
  110.   /**
  111.    * Returns the users birthday, if available.
  112.    *
  113.    * @return \DateTime|null
  114.    */
  115.   public function getBirthday()
  116.   {
  117.     $value = $this->getProperty('birthday');
  118.     if ($value) {
  119.       return new \DateTime($value);
  120.     }
  121.     return null;
  122.   }
  123.  
  124.   /**
  125.    * Returns the current location of the user as a FacebookGraphLocation
  126.    *   if available.
  127.    *
  128.    * @return GraphLocation|null
  129.    */
  130.   public function getLocation()
  131.   {
  132.     return $this->getProperty('location', GraphLocation::className());
  133.   }
  134.  
  135.   /**
  136.    * Returns the timezone for the user as a int if present.
  137.    *
  138.    * @return string|null
  139.    */
  140.   public function getTimezone()
  141.   {
  142.     return $this->getProperty('timezone');
  143.   }
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement