summaryrefslogtreecommitdiff
path: root/lib/facebook-graph-sdk/src/Facebook/GraphNodes
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-01-16 22:04:43 +0100
committeremkael <emkael@tlen.pl>2017-01-16 22:50:24 +0100
commit677953067f2bb5502a70f0d004f1ac844b18a128 (patch)
tree003c26454b543c2a8d73f0602446482fdbbef8db /lib/facebook-graph-sdk/src/Facebook/GraphNodes
parentf7b2bfae9778af2c99e0c7fe7b2634e0f4f0973f (diff)
* Facebook support
Diffstat (limited to 'lib/facebook-graph-sdk/src/Facebook/GraphNodes')
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/Collection.php242
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php113
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php183
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphApplication.php43
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php72
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEdge.php260
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEvent.php242
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphGroup.php171
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphList.php36
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphLocation.php102
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNode.php185
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php392
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObject.php36
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php86
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPage.php125
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPicture.php72
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php102
-rw-r--r--lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphUser.php162
18 files changed, 2624 insertions, 0 deletions
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Collection.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Collection.php
new file mode 100644
index 0000000..cac010b
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Collection.php
@@ -0,0 +1,242 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class Collection
+ *
+ * Modified version of Collection in "illuminate/support" by Taylor Otwell
+ *
+ * @package Facebook
+ */
+
+use ArrayAccess;
+use ArrayIterator;
+use Countable;
+use IteratorAggregate;
+
+class Collection implements ArrayAccess, Countable, IteratorAggregate
+{
+ /**
+ * The items contained in the collection.
+ *
+ * @var array
+ */
+ protected $items = [];
+
+ /**
+ * Create a new collection.
+ *
+ * @param array $items
+ */
+ public function __construct(array $items = [])
+ {
+ $this->items = $items;
+ }
+
+ /**
+ * Gets the value of a field from the Graph node.
+ *
+ * @param string $name The field to retrieve.
+ * @param mixed $default The default to return if the field doesn't exist.
+ *
+ * @return mixed
+ */
+ public function getField($name, $default = null)
+ {
+ if (isset($this->items[$name])) {
+ return $this->items[$name];
+ }
+
+ return $default ?: null;
+ }
+
+ /**
+ * Gets the value of the named property for this graph object.
+ *
+ * @param string $name The property to retrieve.
+ * @param mixed $default The default to return if the property doesn't exist.
+ *
+ * @return mixed
+ *
+ * @deprecated 5.0.0 getProperty() has been renamed to getField()
+ * @todo v6: Remove this method
+ */
+ public function getProperty($name, $default = null)
+ {
+ return $this->getField($name, $default);
+ }
+
+ /**
+ * Returns a list of all fields set on the object.
+ *
+ * @return array
+ */
+ public function getFieldNames()
+ {
+ return array_keys($this->items);
+ }
+
+ /**
+ * Returns a list of all properties set on the object.
+ *
+ * @return array
+ *
+ * @deprecated 5.0.0 getPropertyNames() has been renamed to getFieldNames()
+ * @todo v6: Remove this method
+ */
+ public function getPropertyNames()
+ {
+ return $this->getFieldNames();
+ }
+
+ /**
+ * Get all of the items in the collection.
+ *
+ * @return array
+ */
+ public function all()
+ {
+ return $this->items;
+ }
+
+ /**
+ * Get the collection of items as a plain array.
+ *
+ * @return array
+ */
+ public function asArray()
+ {
+ return array_map(function ($value) {
+ return $value instanceof Collection ? $value->asArray() : $value;
+ }, $this->items);
+ }
+
+ /**
+ * Run a map over each of the items.
+ *
+ * @param \Closure $callback
+ *
+ * @return static
+ */
+ public function map(\Closure $callback)
+ {
+ return new static(array_map($callback, $this->items, array_keys($this->items)));
+ }
+
+ /**
+ * Get the collection of items as JSON.
+ *
+ * @param int $options
+ *
+ * @return string
+ */
+ public function asJson($options = 0)
+ {
+ return json_encode($this->asArray(), $options);
+ }
+
+ /**
+ * Count the number of items in the collection.
+ *
+ * @return int
+ */
+ public function count()
+ {
+ return count($this->items);
+ }
+
+ /**
+ * Get an iterator for the items.
+ *
+ * @return ArrayIterator
+ */
+ public function getIterator()
+ {
+ return new ArrayIterator($this->items);
+ }
+
+ /**
+ * Determine if an item exists at an offset.
+ *
+ * @param mixed $key
+ *
+ * @return bool
+ */
+ public function offsetExists($key)
+ {
+ return array_key_exists($key, $this->items);
+ }
+
+ /**
+ * Get an item at a given offset.
+ *
+ * @param mixed $key
+ *
+ * @return mixed
+ */
+ public function offsetGet($key)
+ {
+ return $this->items[$key];
+ }
+
+ /**
+ * Set the item at a given offset.
+ *
+ * @param mixed $key
+ * @param mixed $value
+ *
+ * @return void
+ */
+ public function offsetSet($key, $value)
+ {
+ if (is_null($key)) {
+ $this->items[] = $value;
+ } else {
+ $this->items[$key] = $value;
+ }
+ }
+
+ /**
+ * Unset the item at a given offset.
+ *
+ * @param string $key
+ *
+ * @return void
+ */
+ public function offsetUnset($key)
+ {
+ unset($this->items[$key]);
+ }
+
+ /**
+ * Convert the collection to its string representation.
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return $this->asJson();
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php
new file mode 100644
index 0000000..3fba815
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php
@@ -0,0 +1,113 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphAchievement
+ *
+ * @package Facebook
+ */
+
+class GraphAchievement extends GraphNode
+{
+ /**
+ * @var array Maps object key names to Graph object types.
+ */
+ protected static $graphObjectMap = [
+ 'from' => '\Facebook\GraphNodes\GraphUser',
+ 'application' => '\Facebook\GraphNodes\GraphApplication',
+ ];
+
+ /**
+ * Returns the ID for the achievement.
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->getField('id');
+ }
+
+ /**
+ * Returns the user who achieved this.
+ *
+ * @return GraphUser|null
+ */
+ public function getFrom()
+ {
+ return $this->getField('from');
+ }
+
+ /**
+ * Returns the time at which this was achieved.
+ *
+ * @return \DateTime|null
+ */
+ public function getPublishTime()
+ {
+ return $this->getField('publish_time');
+ }
+
+ /**
+ * Returns the app in which the user achieved this.
+ *
+ * @return GraphApplication|null
+ */
+ public function getApplication()
+ {
+ return $this->getField('application');
+ }
+
+ /**
+ * Returns information about the achievement type this instance is connected with.
+ *
+ * @return array|null
+ */
+ public function getData()
+ {
+ return $this->getField('data');
+ }
+
+ /**
+ * Returns the type of achievement.
+ *
+ * @see https://developers.facebook.com/docs/graph-api/reference/v2.2/achievement
+ *
+ * @return string
+ */
+ public function getType()
+ {
+ return 'game.achievement';
+ }
+
+ /**
+ * Indicates whether gaining the achievement published a feed story for the user.
+ *
+ * @return boolean|null
+ */
+ public function isNoFeedStory()
+ {
+ return $this->getField('no_feed_story');
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php
new file mode 100644
index 0000000..50d1f2c
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php
@@ -0,0 +1,183 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphAlbum
+ *
+ * @package Facebook
+ */
+
+class GraphAlbum extends GraphNode
+{
+ /**
+ * @var array Maps object key names to Graph object types.
+ */
+ protected static $graphObjectMap = [
+ 'from' => '\Facebook\GraphNodes\GraphUser',
+ 'place' => '\Facebook\GraphNodes\GraphPage',
+ ];
+
+ /**
+ * Returns the ID for the album.
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->getField('id');
+ }
+
+ /**
+ * Returns whether the viewer can upload photos to this album.
+ *
+ * @return boolean|null
+ */
+ public function getCanUpload()
+ {
+ return $this->getField('can_upload');
+ }
+
+ /**
+ * Returns the number of photos in this album.
+ *
+ * @return int|null
+ */
+ public function getCount()
+ {
+ return $this->getField('count');
+ }
+
+ /**
+ * Returns the ID of the album's cover photo.
+ *
+ * @return string|null
+ */
+ public function getCoverPhoto()
+ {
+ return $this->getField('cover_photo');
+ }
+
+ /**
+ * Returns the time the album was initially created.
+ *
+ * @return \DateTime|null
+ */
+ public function getCreatedTime()
+ {
+ return $this->getField('created_time');
+ }
+
+ /**
+ * Returns the time the album was updated.
+ *
+ * @return \DateTime|null
+ */
+ public function getUpdatedTime()
+ {
+ return $this->getField('updated_time');
+ }
+
+ /**
+ * Returns the description of the album.
+ *
+ * @return string|null
+ */
+ public function getDescription()
+ {
+ return $this->getField('description');
+ }
+
+ /**
+ * Returns profile that created the album.
+ *
+ * @return GraphUser|null
+ */
+ public function getFrom()
+ {
+ return $this->getField('from');
+ }
+
+ /**
+ * Returns profile that created the album.
+ *
+ * @return GraphPage|null
+ */
+ public function getPlace()
+ {
+ return $this->getField('place');
+ }
+
+ /**
+ * Returns a link to this album on Facebook.
+ *
+ * @return string|null
+ */
+ public function getLink()
+ {
+ return $this->getField('link');
+ }
+
+ /**
+ * Returns the textual location of the album.
+ *
+ * @return string|null
+ */
+ public function getLocation()
+ {
+ return $this->getField('location');
+ }
+
+ /**
+ * Returns the title of the album.
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->getField('name');
+ }
+
+ /**
+ * Returns the privacy settings for the album.
+ *
+ * @return string|null
+ */
+ public function getPrivacy()
+ {
+ return $this->getField('privacy');
+ }
+
+ /**
+ * Returns the type of the album.
+ *
+ * enum{ profile, mobile, wall, normal, album }
+ *
+ * @return string|null
+ */
+ public function getType()
+ {
+ return $this->getField('type');
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphApplication.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphApplication.php
new file mode 100644
index 0000000..69b09bb
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphApplication.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphApplication
+ *
+ * @package Facebook
+ */
+
+class GraphApplication extends GraphNode
+{
+ /**
+ * Returns the ID for the application.
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->getField('id');
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php
new file mode 100644
index 0000000..ee60750
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphCoverPhoto
+ *
+ * @package Facebook
+ */
+class GraphCoverPhoto extends GraphNode
+{
+ /**
+ * Returns the id of cover if it exists
+ *
+ * @return int|null
+ */
+ public function getId()
+ {
+ return $this->getField('id');
+ }
+
+ /**
+ * Returns the source of cover if it exists
+ *
+ * @return string|null
+ */
+ public function getSource()
+ {
+ return $this->getField('source');
+ }
+
+ /**
+ * Returns the offset_x of cover if it exists
+ *
+ * @return int|null
+ */
+ public function getOffsetX()
+ {
+ return $this->getField('offset_x');
+ }
+
+ /**
+ * Returns the offset_y of cover if it exists
+ *
+ * @return int|null
+ */
+ public function getOffsetY()
+ {
+ return $this->getField('offset_y');
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEdge.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEdge.php
new file mode 100644
index 0000000..95f3284
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEdge.php
@@ -0,0 +1,260 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+use Facebook\FacebookRequest;
+use Facebook\Url\FacebookUrlManipulator;
+use Facebook\Exceptions\FacebookSDKException;
+
+/**
+ * Class GraphEdge
+ *
+ * @package Facebook
+ */
+class GraphEdge extends Collection
+{
+ /**
+ * @var FacebookRequest The original request that generated this data.
+ */
+ protected $request;
+
+ /**
+ * @var array An array of Graph meta data like pagination, etc.
+ */
+ protected $metaData = [];
+
+ /**
+ * @var string|null The parent Graph edge endpoint that generated the list.
+ */
+ protected $parentEdgeEndpoint;
+
+ /**
+ * @var string|null The subclass of the child GraphNode's.
+ */
+ protected $subclassName;
+
+ /**
+ * Init this collection of GraphNode's.
+ *
+ * @param FacebookRequest $request The original request that generated this data.
+ * @param array $data An array of GraphNode's.
+ * @param array $metaData An array of Graph meta data like pagination, etc.
+ * @param string|null $parentEdgeEndpoint The parent Graph edge endpoint that generated the list.
+ * @param string|null $subclassName The subclass of the child GraphNode's.
+ */
+ public function __construct(FacebookRequest $request, array $data = [], array $metaData = [], $parentEdgeEndpoint = null, $subclassName = null)
+ {
+ $this->request = $request;
+ $this->metaData = $metaData;
+ $this->parentEdgeEndpoint = $parentEdgeEndpoint;
+ $this->subclassName = $subclassName;
+
+ parent::__construct($data);
+ }
+
+ /**
+ * Gets the parent Graph edge endpoint that generated the list.
+ *
+ * @return string|null
+ */
+ public function getParentGraphEdge()
+ {
+ return $this->parentEdgeEndpoint;
+ }
+
+ /**
+ * Gets the subclass name that the child GraphNode's are cast as.
+ *
+ * @return string|null
+ */
+ public function getSubClassName()
+ {
+ return $this->subclassName;
+ }
+
+ /**
+ * Returns the raw meta data associated with this GraphEdge.
+ *
+ * @return array
+ */
+ public function getMetaData()
+ {
+ return $this->metaData;
+ }
+
+ /**
+ * Returns the next cursor if it exists.
+ *
+ * @return string|null
+ */
+ public function getNextCursor()
+ {
+ return $this->getCursor('after');
+ }
+
+ /**
+ * Returns the previous cursor if it exists.
+ *
+ * @return string|null
+ */
+ public function getPreviousCursor()
+ {
+ return $this->getCursor('before');
+ }
+
+ /**
+ * Returns the cursor for a specific direction if it exists.
+ *
+ * @param string $direction The direction of the page: after|before
+ *
+ * @return string|null
+ */
+ public function getCursor($direction)
+ {
+ if (isset($this->metaData['paging']['cursors'][$direction])) {
+ return $this->metaData['paging']['cursors'][$direction];
+ }
+
+ return null;
+ }
+
+ /**
+ * Generates a pagination URL based on a cursor.
+ *
+ * @param string $direction The direction of the page: next|previous
+ *
+ * @return string|null
+ *
+ * @throws FacebookSDKException
+ */
+ public function getPaginationUrl($direction)
+ {
+ $this->validateForPagination();
+
+ // Do we have a paging URL?
+ if (isset($this->metaData['paging'][$direction])) {
+ // Graph returns the full URL with all the original params.
+ // We just want the endpoint though.
+ $pageUrl = $this->metaData['paging'][$direction];
+
+ return FacebookUrlManipulator::baseGraphUrlEndpoint($pageUrl);
+ }
+
+ // Do we have a cursor to work with?
+ $cursorDirection = $direction === 'next' ? 'after' : 'before';
+ $cursor = $this->getCursor($cursorDirection);
+ if (!$cursor) {
+ return null;
+ }
+
+ // If we don't know the ID of the parent node, this ain't gonna work.
+ if (!$this->parentEdgeEndpoint) {
+ return null;
+ }
+
+ // We have the parent node ID, paging cursor & original request.
+ // These were the ingredients chosen to create the perfect little URL.
+ $pageUrl = $this->parentEdgeEndpoint . '?' . $cursorDirection . '=' . urlencode($cursor);
+
+ // Pull in the original params
+ $originalUrl = $this->request->getUrl();
+ $pageUrl = FacebookUrlManipulator::mergeUrlParams($originalUrl, $pageUrl);
+
+ return FacebookUrlManipulator::forceSlashPrefix($pageUrl);
+ }
+
+ /**
+ * Validates whether or not we can paginate on this request.
+ *
+ * @throws FacebookSDKException
+ */
+ public function validateForPagination()
+ {
+ if ($this->request->getMethod() !== 'GET') {
+ throw new FacebookSDKException('You can only paginate on a GET request.', 720);
+ }
+ }
+
+ /**
+ * Gets the request object needed to make a next|previous page request.
+ *
+ * @param string $direction The direction of the page: next|previous
+ *
+ * @return FacebookRequest|null
+ *
+ * @throws FacebookSDKException
+ */
+ public function getPaginationRequest($direction)
+ {
+ $pageUrl = $this->getPaginationUrl($direction);
+ if (!$pageUrl) {
+ return null;
+ }
+
+ $newRequest = clone $this->request;
+ $newRequest->setEndpoint($pageUrl);
+
+ return $newRequest;
+ }
+
+ /**
+ * Gets the request object needed to make a "next" page request.
+ *
+ * @return FacebookRequest|null
+ *
+ * @throws FacebookSDKException
+ */
+ public function getNextPageRequest()
+ {
+ return $this->getPaginationRequest('next');
+ }
+
+ /**
+ * Gets the request object needed to make a "previous" page request.
+ *
+ * @return FacebookRequest|null
+ *
+ * @throws FacebookSDKException
+ */
+ public function getPreviousPageRequest()
+ {
+ return $this->getPaginationRequest('previous');
+ }
+
+ /**
+ * The total number of results according to Graph if it exists.
+ *
+ * This will be returned if the summary=true modifier is present in the request.
+ *
+ * @return int|null
+ */
+ public function getTotalCount()
+ {
+ if (isset($this->metaData['summary']['total_count'])) {
+ return $this->metaData['summary']['total_count'];
+ }
+
+ return null;
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEvent.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEvent.php
new file mode 100644
index 0000000..19ff2fb
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEvent.php
@@ -0,0 +1,242 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphEvent
+ *
+ * @package Facebook
+ */
+class GraphEvent extends GraphNode
+{
+ /**
+ * @var array Maps object key names to GraphNode types.
+ */
+ protected static $graphObjectMap = [
+ 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
+ 'place' => '\Facebook\GraphNodes\GraphPage',
+ 'picture' => '\Facebook\GraphNodes\GraphPicture',
+ 'parent_group' => '\Facebook\GraphNodes\GraphGroup',
+ ];
+
+ /**
+ * Returns the `id` (The event ID) as string if present.
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->getField('id');
+ }
+
+ /**
+ * Returns the `cover` (Cover picture) as GraphCoverPhoto if present.
+ *
+ * @return GraphCoverPhoto|null
+ */
+ public function getCover()
+ {
+ return $this->getField('cover');
+ }
+
+ /**
+ * Returns the `description` (Long-form description) as string if present.
+ *
+ * @return string|null
+ */
+ public function getDescription()
+ {
+ return $this->getField('description');
+ }
+
+ /**
+ * Returns the `end_time` (End time, if one has been set) as DateTime if present.
+ *
+ * @return \DateTime|null
+ */
+ public function getEndTime()
+ {
+ return $this->getField('end_time');
+ }
+
+ /**
+ * Returns the `is_date_only` (Whether the event only has a date specified, but no time) as bool if present.
+ *
+ * @return bool|null
+ */
+ public function getIsDateOnly()
+ {
+ return $this->getField('is_date_only');
+ }
+
+ /**
+ * Returns the `name` (Event name) as string if present.
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->getField('name');
+ }
+
+ /**
+ * Returns the `owner` (The profile that created the event) as GraphNode if present.
+ *
+ * @return GraphNode|null
+ */
+ public function getOwner()
+ {
+ return $this->getField('owner');
+ }
+
+ /**
+ * Returns the `parent_group` (The group the event belongs to) as GraphGroup if present.
+ *
+ * @return GraphGroup|null
+ */
+ public function getParentGroup()
+ {
+ return $this->getField('parent_group');
+ }
+
+ /**
+ * Returns the `place` (Event Place information) as GraphPage if present.
+ *
+ * @return GraphPage|null
+ */
+ public function getPlace()
+ {
+ return $this->getField('place');
+ }
+
+ /**
+ * Returns the `privacy` (Who can see the event) as string if present.
+ *
+ * @return string|null
+ */
+ public function getPrivacy()
+ {
+ return $this->getField('privacy');
+ }
+
+ /**
+ * Returns the `start_time` (Start time) as DateTime if present.
+ *
+ * @return \DateTime|null
+ */
+ public function getStartTime()
+ {
+ return $this->getField('start_time');
+ }
+
+ /**
+ * Returns the `ticket_uri` (The link users can visit to buy a ticket to this event) as string if present.
+ *
+ * @return string|null
+ */
+ public function getTicketUri()
+ {
+ return $this->getField('ticket_uri');
+ }
+
+ /**
+ * Returns the `timezone` (Timezone) as string if present.
+ *
+ * @return string|null
+ */
+ public function getTimezone()
+ {
+ return $this->getField('timezone');
+ }
+
+ /**
+ * Returns the `updated_time` (Last update time) as DateTime if present.
+ *
+ * @return \DateTime|null
+ */
+ public function getUpdatedTime()
+ {
+ return $this->getField('updated_time');
+ }
+
+ /**
+ * Returns the `picture` (Event picture) as GraphPicture if present.
+ *
+ * @return GraphPicture|null
+ */
+ public function getPicture()
+ {
+ return $this->getField('picture');
+ }
+
+ /**
+ * Returns the `attending_count` (Number of people attending the event) as int if present.
+ *
+ * @return int|null
+ */
+ public function getAttendingCount()
+ {
+ return $this->getField('attending_count');
+ }
+
+ /**
+ * Returns the `declined_count` (Number of people who declined the event) as int if present.
+ *
+ * @return int|null
+ */
+ public function getDeclinedCount()
+ {
+ return $this->getField('declined_count');
+ }
+
+ /**
+ * Returns the `maybe_count` (Number of people who maybe going to the event) as int if present.
+ *
+ * @return int|null
+ */
+ public function getMaybeCount()
+ {
+ return $this->getField('maybe_count');
+ }
+
+ /**
+ * Returns the `noreply_count` (Number of people who did not reply to the event) as int if present.
+ *
+ * @return int|null
+ */
+ public function getNoreplyCount()
+ {
+ return $this->getField('noreply_count');
+ }
+
+ /**
+ * Returns the `invited_count` (Number of people invited to the event) as int if present.
+ *
+ * @return int|null
+ */
+ public function getInvitedCount()
+ {
+ return $this->getField('invited_count');
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphGroup.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphGroup.php
new file mode 100644
index 0000000..07a4dbd
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphGroup.php
@@ -0,0 +1,171 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphGroup
+ *
+ * @package Facebook
+ */
+class GraphGroup extends GraphNode
+{
+ /**
+ * @var array Maps object key names to GraphNode types.
+ */
+ protected static $graphObjectMap = [
+ 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
+ 'venue' => '\Facebook\GraphNodes\GraphLocation',
+ ];
+
+ /**
+ * Returns the `id` (The Group ID) as string if present.
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->getField('id');
+ }
+
+ /**
+ * Returns the `cover` (The cover photo of the Group) as GraphCoverPhoto if present.
+ *
+ * @return GraphCoverPhoto|null
+ */
+ public function getCover()
+ {
+ return $this->getField('cover');
+ }
+
+ /**
+ * Returns the `description` (A brief description of the Group) as string if present.
+ *
+ * @return string|null
+ */
+ public function getDescription()
+ {
+ return $this->getField('description');
+ }
+
+ /**
+ * Returns the `email` (The email address to upload content to the Group. Only current members of the Group can use this) as string if present.
+ *
+ * @return string|null
+ */
+ public function getEmail()
+ {
+ return $this->getField('email');
+ }
+
+ /**
+ * Returns the `icon` (The URL for the Group's icon) as string if present.
+ *
+ * @return string|null
+ */
+ public function getIcon()
+ {
+ return $this->getField('icon');
+ }
+
+ /**
+ * Returns the `link` (The Group's website) as string if present.
+ *
+ * @return string|null
+ */
+ public function getLink()
+ {
+ return $this->getField('link');
+ }
+
+ /**
+ * Returns the `name` (The name of the Group) as string if present.
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->getField('name');
+ }
+
+ /**
+ * Returns the `member_request_count` (Number of people asking to join the group.) as int if present.
+ *
+ * @return int|null
+ */
+ public function getMemberRequestCount()
+ {
+ return $this->getField('member_request_count');
+ }
+
+ /**
+ * Returns the `owner` (The profile that created this Group) as GraphNode if present.
+ *
+ * @return GraphNode|null
+ */
+ public function getOwner()
+ {
+ return $this->getField('owner');
+ }
+
+ /**
+ * Returns the `parent` (The parent Group of this Group, if it exists) as GraphNode if present.
+ *
+ * @return GraphNode|null
+ */
+ public function getParent()
+ {
+ return $this->getField('parent');
+ }
+
+ /**
+ * Returns the `privacy` (The privacy setting of the Group) as string if present.
+ *
+ * @return string|null
+ */
+ public function getPrivacy()
+ {
+ return $this->getField('privacy');
+ }
+
+ /**
+ * Returns the `updated_time` (The last time the Group was updated (this includes changes in the Group's properties and changes in posts and comments if user can see them)) as \DateTime if present.
+ *
+ * @return \DateTime|null
+ */
+ public function getUpdatedTime()
+ {
+ return $this->getField('updated_time');
+ }
+
+ /**
+ * Returns the `venue` (The location for the Group) as GraphLocation if present.
+ *
+ * @return GraphLocation|null
+ */
+ public function getVenue()
+ {
+ return $this->getField('venue');
+ }
+
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphList.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphList.php
new file mode 100644
index 0000000..a60a07a
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphList.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphList
+ *
+ * @package Facebook
+ *
+ * @deprecated 5.0.0 GraphList has been renamed to GraphEdge
+ * @todo v6: Remove this class
+ */
+class GraphList extends GraphEdge
+{
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphLocation.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphLocation.php
new file mode 100644
index 0000000..187a399
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphLocation.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphLocation
+ *
+ * @package Facebook
+ */
+class GraphLocation extends GraphNode
+{
+ /**
+ * Returns the street component of the location
+ *
+ * @return string|null
+ */
+ public function getStreet()
+ {
+ return $this->getField('street');
+ }
+
+ /**
+ * Returns the city component of the location
+ *
+ * @return string|null
+ */
+ public function getCity()
+ {
+ return $this->getField('city');
+ }
+
+ /**
+ * Returns the state component of the location
+ *
+ * @return string|null
+ */
+ public function getState()
+ {
+ return $this->getField('state');
+ }
+
+ /**
+ * Returns the country component of the location
+ *
+ * @return string|null
+ */
+ public function getCountry()
+ {
+ return $this->getField('country');
+ }
+
+ /**
+ * Returns the zipcode component of the location
+ *
+ * @return string|null
+ */
+ public function getZip()
+ {
+ return $this->getField('zip');
+ }
+
+ /**
+ * Returns the latitude component of the location
+ *
+ * @return float|null
+ */
+ public function getLatitude()
+ {
+ return $this->getField('latitude');
+ }
+
+ /**
+ * Returns the street component of the location
+ *
+ * @return float|null
+ */
+ public function getLongitude()
+ {
+ return $this->getField('longitude');
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNode.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNode.php
new file mode 100644
index 0000000..0d2f504
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNode.php
@@ -0,0 +1,185 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphNode
+ *
+ * @package Facebook
+ */
+class GraphNode extends Collection
+{
+ /**
+ * @var array Maps object key names to Graph object types.
+ */
+ protected static $graphObjectMap = [];
+
+ /**
+ * Init this Graph object.
+ *
+ * @param array $data
+ */
+ public function __construct(array $data = [])
+ {
+ parent::__construct($this->castItems($data));
+ }
+
+ /**
+ * Iterates over an array and detects the types each node
+ * should be cast to and returns all the items as an array.
+ *
+ * @TODO Add auto-casting to AccessToken entities.
+ *
+ * @param array $data The array to iterate over.
+ *
+ * @return array
+ */
+ public function castItems(array $data)
+ {
+ $items = [];
+
+ foreach ($data as $k => $v) {
+ if ($this->shouldCastAsDateTime($k)
+ && (is_numeric($v)
+ || $k === 'birthday'
+ || $this->isIso8601DateString($v))
+ ) {
+ $items[$k] = $this->castToDateTime($v);
+ } else {
+ $items[$k] = $v;
+ }
+ }
+
+ return $items;
+ }
+
+ /**
+ * Uncasts any auto-casted datatypes.
+ * Basically the reverse of castItems().
+ *
+ * @return array
+ */
+ public function uncastItems()
+ {
+ $items = $this->asArray();
+
+ return array_map(function ($v) {
+ if ($v instanceof \DateTime) {
+ return $v->format(\DateTime::ISO8601);
+ }
+
+ return $v;
+ }, $items);
+ }
+
+ /**
+ * Get the collection of items as JSON.
+ *
+ * @param int $options
+ *
+ * @return string
+ */
+ public function asJson($options = 0)
+ {
+ return json_encode($this->uncastItems(), $options);
+ }
+
+ /**
+ * Detects an ISO 8601 formatted string.
+ *
+ * @param string $string
+ *
+ * @return boolean
+ *
+ * @see https://developers.facebook.com/docs/graph-api/using-graph-api/#readmodifiers
+ * @see http://www.cl.cam.ac.uk/~mgk25/iso-time.html
+ * @see http://en.wikipedia.org/wiki/ISO_8601
+ */
+ public function isIso8601DateString($string)
+ {
+ // This insane regex was yoinked from here:
+ // http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
+ // ...and I'm all like:
+ // http://thecodinglove.com/post/95378251969/when-code-works-and-i-dont-know-why
+ $crazyInsaneRegexThatSomehowDetectsIso8601 = '/^([\+-]?\d{4}(?!\d{2}\b))'
+ . '((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?'
+ . '|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d'
+ . '|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])'
+ . '((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d'
+ . '([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/';
+
+ return preg_match($crazyInsaneRegexThatSomehowDetectsIso8601, $string) === 1;
+ }
+
+ /**
+ * Determines if a value from Graph should be cast to DateTime.
+ *
+ * @param string $key
+ *
+ * @return boolean
+ */
+ public function shouldCastAsDateTime($key)
+ {
+ return in_array($key, [
+ 'created_time',
+ 'updated_time',
+ 'start_time',
+ 'end_time',
+ 'backdated_time',
+ 'issued_at',
+ 'expires_at',
+ 'birthday',
+ 'publish_time'
+ ], true);
+ }
+
+ /**
+ * Casts a date value from Graph to DateTime.
+ *
+ * @param int|string $value
+ *
+ * @return \DateTime
+ */
+ public function castToDateTime($value)
+ {
+ if (is_int($value)) {
+ $dt = new \DateTime();
+ $dt->setTimestamp($value);
+ } else {
+ $dt = new \DateTime($value);
+ }
+
+ return $dt;
+ }
+
+ /**
+ * Getter for $graphObjectMap.
+ *
+ * @return array
+ */
+ public static function getObjectMap()
+ {
+ return static::$graphObjectMap;
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php
new file mode 100644
index 0000000..e1bedd9
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php
@@ -0,0 +1,392 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+use Facebook\FacebookResponse;
+use Facebook\Exceptions\FacebookSDKException;
+
+/**
+ * Class GraphNodeFactory
+ *
+ * @package Facebook
+ *
+ * ## Assumptions ##
+ * GraphEdge - is ALWAYS a numeric array
+ * GraphEdge - is ALWAYS an array of GraphNode types
+ * GraphNode - is ALWAYS an associative array
+ * GraphNode - MAY contain GraphNode's "recurrable"
+ * GraphNode - MAY contain GraphEdge's "recurrable"
+ * GraphNode - MAY contain DateTime's "primitives"
+ * GraphNode - MAY contain string's "primitives"
+ */
+class GraphNodeFactory
+{
+ /**
+ * @const string The base graph object class.
+ */
+ const BASE_GRAPH_NODE_CLASS = '\Facebook\GraphNodes\GraphNode';
+
+ /**
+ * @const string The base graph edge class.
+ */
+ const BASE_GRAPH_EDGE_CLASS = '\Facebook\GraphNodes\GraphEdge';
+
+ /**
+ * @const string The graph object prefix.
+ */
+ const BASE_GRAPH_OBJECT_PREFIX = '\Facebook\GraphNodes\\';
+
+ /**
+ * @var FacebookResponse The response entity from Graph.
+ */
+ protected $response;
+
+ /**
+ * @var array The decoded body of the FacebookResponse entity from Graph.
+ */
+ protected $decodedBody;
+
+ /**
+ * Init this Graph object.
+ *
+ * @param FacebookResponse $response The response entity from Graph.
+ */
+ public function __construct(FacebookResponse $response)
+ {
+ $this->response = $response;
+ $this->decodedBody = $response->getDecodedBody();
+ }
+
+ /**
+ * Tries to convert a FacebookResponse entity into a GraphNode.
+ *
+ * @param string|null $subclassName The GraphNode sub class to cast to.
+ *
+ * @return GraphNode
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphNode($subclassName = null)
+ {
+ $this->validateResponseAsArray();
+ $this->validateResponseCastableAsGraphNode();
+
+ return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName);
+ }
+
+ /**
+ * Convenience method for creating a GraphAchievement collection.
+ *
+ * @return GraphAchievement
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphAchievement()
+ {
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAchievement');
+ }
+
+ /**
+ * Convenience method for creating a GraphAlbum collection.
+ *
+ * @return GraphAlbum
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphAlbum()
+ {
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAlbum');
+ }
+
+ /**
+ * Convenience method for creating a GraphPage collection.
+ *
+ * @return GraphPage
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphPage()
+ {
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphPage');
+ }
+
+ /**
+ * Convenience method for creating a GraphSessionInfo collection.
+ *
+ * @return GraphSessionInfo
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphSessionInfo()
+ {
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphSessionInfo');
+ }
+
+ /**
+ * Convenience method for creating a GraphUser collection.
+ *
+ * @return GraphUser
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphUser()
+ {
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphUser');
+ }
+
+ /**
+ * Convenience method for creating a GraphEvent collection.
+ *
+ * @return GraphEvent
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphEvent()
+ {
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
+ }
+
+ /**
+ * Convenience method for creating a GraphGroup collection.
+ *
+ * @return GraphGroup
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphGroup()
+ {
+ return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphGroup');
+ }
+
+ /**
+ * Tries to convert a FacebookResponse entity into a GraphEdge.
+ *
+ * @param string|null $subclassName The GraphNode sub class to cast the list items to.
+ * @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
+ *
+ * @return GraphEdge
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphEdge($subclassName = null, $auto_prefix = true)
+ {
+ $this->validateResponseAsArray();
+ $this->validateResponseCastableAsGraphEdge();
+
+ if ($subclassName && $auto_prefix) {
+ $subclassName = static::BASE_GRAPH_OBJECT_PREFIX . $subclassName;
+ }
+
+ return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName);
+ }
+
+ /**
+ * Validates the decoded body.
+ *
+ * @throws FacebookSDKException
+ */
+ public function validateResponseAsArray()
+ {
+ if (!is_array($this->decodedBody)) {
+ throw new FacebookSDKException('Unable to get response from Graph as array.', 620);
+ }
+ }
+
+ /**
+ * Validates that the return data can be cast as a GraphNode.
+ *
+ * @throws FacebookSDKException
+ */
+ public function validateResponseCastableAsGraphNode()
+ {
+ if (isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data'])) {
+ throw new FacebookSDKException(
+ 'Unable to convert response from Graph to a GraphNode because the response looks like a GraphEdge. Try using GraphNodeFactory::makeGraphEdge() instead.',
+ 620
+ );
+ }
+ }
+
+ /**
+ * Validates that the return data can be cast as a GraphEdge.
+ *
+ * @throws FacebookSDKException
+ */
+ public function validateResponseCastableAsGraphEdge()
+ {
+ if (!(isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data']))) {
+ throw new FacebookSDKException(
+ 'Unable to convert response from Graph to a GraphEdge because the response does not look like a GraphEdge. Try using GraphNodeFactory::makeGraphNode() instead.',
+ 620
+ );
+ }
+ }
+
+ /**
+ * Safely instantiates a GraphNode of $subclassName.
+ *
+ * @param array $data The array of data to iterate over.
+ * @param string|null $subclassName The subclass to cast this collection to.
+ *
+ * @return GraphNode
+ *
+ * @throws FacebookSDKException
+ */
+ public function safelyMakeGraphNode(array $data, $subclassName = null)
+ {
+ $subclassName = $subclassName ?: static::BASE_GRAPH_NODE_CLASS;
+ static::validateSubclass($subclassName);
+
+ // Remember the parent node ID
+ $parentNodeId = isset($data['id']) ? $data['id'] : null;
+
+ $items = [];
+
+ foreach ($data as $k => $v) {
+ // Array means could be recurable
+ if (is_array($v)) {
+ // Detect any smart-casting from the $graphObjectMap array.
+ // This is always empty on the GraphNode collection, but subclasses can define
+ // their own array of smart-casting types.
+ $graphObjectMap = $subclassName::getObjectMap();
+ $objectSubClass = isset($graphObjectMap[$k])
+ ? $graphObjectMap[$k]
+ : null;
+
+ // Could be a GraphEdge or GraphNode
+ $items[$k] = $this->castAsGraphNodeOrGraphEdge($v, $objectSubClass, $k, $parentNodeId);
+ } else {
+ $items[$k] = $v;
+ }
+ }
+
+ return new $subclassName($items);
+ }
+
+ /**
+ * Takes an array of values and determines how to cast each node.
+ *
+ * @param array $data The array of data to iterate over.
+ * @param string|null $subclassName The subclass to cast this collection to.
+ * @param string|null $parentKey The key of this data (Graph edge).
+ * @param string|null $parentNodeId The parent Graph node ID.
+ *
+ * @return GraphNode|GraphEdge
+ *
+ * @throws FacebookSDKException
+ */
+ public function castAsGraphNodeOrGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null)
+ {
+ if (isset($data['data'])) {
+ // Create GraphEdge
+ if (static::isCastableAsGraphEdge($data['data'])) {
+ return $this->safelyMakeGraphEdge($data, $subclassName, $parentKey, $parentNodeId);
+ }
+ // Sometimes Graph is a weirdo and returns a GraphNode under the "data" key
+ $data = $data['data'];
+ }
+
+ // Create GraphNode
+ return $this->safelyMakeGraphNode($data, $subclassName);
+ }
+
+ /**
+ * Return an array of GraphNode's.
+ *
+ * @param array $data The array of data to iterate over.
+ * @param string|null $subclassName The GraphNode subclass to cast each item in the list to.
+ * @param string|null $parentKey The key of this data (Graph edge).
+ * @param string|null $parentNodeId The parent Graph node ID.
+ *
+ * @return GraphEdge
+ *
+ * @throws FacebookSDKException
+ */
+ public function safelyMakeGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null)
+ {
+ if (!isset($data['data'])) {
+ throw new FacebookSDKException('Cannot cast data to GraphEdge. Expected a "data" key.', 620);
+ }
+
+ $dataList = [];
+ foreach ($data['data'] as $graphNode) {
+ $dataList[] = $this->safelyMakeGraphNode($graphNode, $subclassName, $parentKey, $parentNodeId);
+ }
+
+ $metaData = $this->getMetaData($data);
+
+ // We'll need to make an edge endpoint for this in case it's a GraphEdge (for cursor pagination)
+ $parentGraphEdgeEndpoint = $parentNodeId && $parentKey ? '/' . $parentNodeId . '/' . $parentKey : null;
+ $className = static::BASE_GRAPH_EDGE_CLASS;
+
+ return new $className($this->response->getRequest(), $dataList, $metaData, $parentGraphEdgeEndpoint, $subclassName);
+ }
+
+ /**
+ * Get the meta data from a list in a Graph response.
+ *
+ * @param array $data The Graph response.
+ *
+ * @return array
+ */
+ public function getMetaData(array $data)
+ {
+ unset($data['data']);
+
+ return $data;
+ }
+
+ /**
+ * Determines whether or not the data should be cast as a GraphEdge.
+ *
+ * @param array $data
+ *
+ * @return boolean
+ */
+ public static function isCastableAsGraphEdge(array $data)
+ {
+ if ($data === []) {
+ return true;
+ }
+
+ // Checks for a sequential numeric array which would be a GraphEdge
+ return array_keys($data) === range(0, count($data) - 1);
+ }
+
+ /**
+ * Ensures that the subclass in question is valid.
+ *
+ * @param string $subclassName The GraphNode subclass to validate.
+ *
+ * @throws FacebookSDKException
+ */
+ public static function validateSubclass($subclassName)
+ {
+ if ($subclassName == static::BASE_GRAPH_NODE_CLASS || is_subclass_of($subclassName, static::BASE_GRAPH_NODE_CLASS)) {
+ return;
+ }
+
+ throw new FacebookSDKException('The given subclass "' . $subclassName . '" is not valid. Cannot cast to an object that is not a GraphNode subclass.', 620);
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObject.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObject.php
new file mode 100644
index 0000000..bb8f8e4
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObject.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphObject
+ *
+ * @package Facebook
+ *
+ * @deprecated 5.0.0 GraphObject has been renamed to GraphNode
+ * @todo v6: Remove this class
+ */
+class GraphObject extends GraphNode
+{
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php
new file mode 100644
index 0000000..94963a0
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php
@@ -0,0 +1,86 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphObjectFactory
+ *
+ * @package Facebook
+ *
+ * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
+ * @todo v6: Remove this class
+ */
+class GraphObjectFactory extends GraphNodeFactory
+{
+ /**
+ * @const string The base graph object class.
+ */
+ const BASE_GRAPH_NODE_CLASS = '\Facebook\GraphNodes\GraphObject';
+
+ /**
+ * @const string The base graph edge class.
+ */
+ const BASE_GRAPH_EDGE_CLASS = '\Facebook\GraphNodes\GraphList';
+
+ /**
+ * Tries to convert a FacebookResponse entity into a GraphNode.
+ *
+ * @param string|null $subclassName The GraphNode sub class to cast to.
+ *
+ * @return GraphNode
+ *
+ * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
+ */
+ public function makeGraphObject($subclassName = null)
+ {
+ return $this->makeGraphNode($subclassName);
+ }
+
+ /**
+ * Convenience method for creating a GraphEvent collection.
+ *
+ * @return GraphEvent
+ *
+ * @throws FacebookSDKException
+ */
+ public function makeGraphEvent()
+ {
+ return $this->makeGraphObject(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
+ }
+
+ /**
+ * Tries to convert a FacebookResponse entity into a GraphEdge.
+ *
+ * @param string|null $subclassName The GraphNode sub class to cast the list items to.
+ * @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
+ *
+ * @return GraphEdge
+ *
+ * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
+ */
+ public function makeGraphList($subclassName = null, $auto_prefix = true)
+ {
+ return $this->makeGraphEdge($subclassName, $auto_prefix);
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPage.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPage.php
new file mode 100644
index 0000000..ab8e31a
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPage.php
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphPage
+ *
+ * @package Facebook
+ */
+class GraphPage extends GraphNode
+{
+ /**
+ * @var array Maps object key names to Graph object types.
+ */
+ protected static $graphObjectMap = [
+ 'best_page' => '\Facebook\GraphNodes\GraphPage',
+ 'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage',
+ 'location' => '\Facebook\GraphNodes\GraphLocation',
+ ];
+
+ /**
+ * Returns the ID for the user's page as a string if present.
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->getField('id');
+ }
+
+ /**
+ * Returns the Category for the user's page as a string if present.
+ *
+ * @return string|null
+ */
+ public function getCategory()
+ {
+ return $this->getField('category');
+ }
+
+ /**
+ * Returns the Name of the user's page as a string if present.
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->getField('name');
+ }
+
+ /**
+ * Returns the best available Page on Facebook.
+ *
+ * @return GraphPage|null
+ */
+ public function getBestPage()
+ {
+ return $this->getField('best_page');
+ }
+
+ /**
+ * Returns the brand's global (parent) Page.
+ *
+ * @return GraphPage|null
+ */
+ public function getGlobalBrandParentPage()
+ {
+ return $this->getField('global_brand_parent_page');
+ }
+
+ /**
+ * Returns the location of this place.
+ *
+ * @return GraphLocation|null
+ */
+ public function getLocation()
+ {
+ return $this->getField('location');
+ }
+
+ /**
+ * Returns the page access token for the admin user.
+ *
+ * Only available in the `/me/accounts` context.
+ *
+ * @return string|null
+ */
+ public function getAccessToken()
+ {
+ return $this->getField('access_token');
+ }
+
+ /**
+ * Returns the roles of the page admin user.
+ *
+ * Only available in the `/me/accounts` context.
+ *
+ * @return array|null
+ */
+ public function getPerms()
+ {
+ return $this->getField('perms');
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPicture.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPicture.php
new file mode 100644
index 0000000..bfd37fa
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPicture.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphPicture
+ *
+ * @package Facebook
+ */
+class GraphPicture extends GraphNode
+{
+ /**
+ * Returns true if user picture is silhouette.
+ *
+ * @return bool|null
+ */
+ public function isSilhouette()
+ {
+ return $this->getField('is_silhouette');
+ }
+
+ /**
+ * Returns the url of user picture if it exists
+ *
+ * @return string|null
+ */
+ public function getUrl()
+ {
+ return $this->getField('url');
+ }
+
+ /**
+ * Returns the width of user picture if it exists
+ *
+ * @return int|null
+ */
+ public function getWidth()
+ {
+ return $this->getField('width');
+ }
+
+ /**
+ * Returns the height of user picture if it exists
+ *
+ * @return int|null
+ */
+ public function getHeight()
+ {
+ return $this->getField('height');
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
new file mode 100644
index 0000000..3c9e2ff
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphSessionInfo
+ *
+ * @package Facebook
+ */
+class GraphSessionInfo extends GraphNode
+{
+ /**
+ * Returns the application id the token was issued for.
+ *
+ * @return string|null
+ */
+ public function getAppId()
+ {
+ return $this->getField('app_id');
+ }
+
+ /**
+ * Returns the application name the token was issued for.
+ *
+ * @return string|null
+ */
+ public function getApplication()
+ {
+ return $this->getField('application');
+ }
+
+ /**
+ * Returns the date & time that the token expires.
+ *
+ * @return \DateTime|null
+ */
+ public function getExpiresAt()
+ {
+ return $this->getField('expires_at');
+ }
+
+ /**
+ * Returns whether the token is valid.
+ *
+ * @return boolean
+ */
+ public function getIsValid()
+ {
+ return $this->getField('is_valid');
+ }
+
+ /**
+ * Returns the date & time the token was issued at.
+ *
+ * @return \DateTime|null
+ */
+ public function getIssuedAt()
+ {
+ return $this->getField('issued_at');
+ }
+
+ /**
+ * Returns the scope permissions associated with the token.
+ *
+ * @return array
+ */
+ public function getScopes()
+ {
+ return $this->getField('scopes');
+ }
+
+ /**
+ * Returns the login id of the user associated with the token.
+ *
+ * @return string|null
+ */
+ public function getUserId()
+ {
+ return $this->getField('user_id');
+ }
+}
diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphUser.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphUser.php
new file mode 100644
index 0000000..cb9ddbb
--- /dev/null
+++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphUser.php
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Copyright 2014 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\GraphNodes;
+
+/**
+ * Class GraphUser
+ *
+ * @package Facebook
+ */
+class GraphUser extends GraphNode
+{
+ /**
+ * @var array Maps object key names to Graph object types.
+ */
+ protected static $graphObjectMap = [
+ 'hometown' => '\Facebook\GraphNodes\GraphPage',
+ 'location' => '\Facebook\GraphNodes\GraphPage',
+ 'significant_other' => '\Facebook\GraphNodes\GraphUser',
+ 'picture' => '\Facebook\GraphNodes\GraphPicture',
+ ];
+
+ /**
+ * Returns the ID for the user as a string if present.
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->getField('id');
+ }
+
+ /**
+ * Returns the name for the user as a string if present.
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->getField('name');
+ }
+
+ /**
+ * Returns the first name for the user as a string if present.
+ *
+ * @return string|null
+ */
+ public function getFirstName()
+ {
+ return $this->getField('first_name');
+ }
+
+ /**
+ * Returns the middle name for the user as a string if present.
+ *
+ * @return string|null
+ */
+ public function getMiddleName()
+ {
+ return $this->getField('middle_name');
+ }
+
+ /**
+ * Returns the last name for the user as a string if present.
+ *
+ * @return string|null
+ */
+ public function getLastName()
+ {
+ return $this->getField('last_name');
+ }
+
+ /**
+ * Returns the gender for the user as a string if present.
+ *
+ * @return string|null
+ */
+ public function getGender()
+ {
+ return $this->getField('gender');
+ }
+
+ /**
+ * Returns the Facebook URL for the user as a string if available.
+ *
+ * @return string|null
+ */
+ public function getLink()
+ {
+ return $this->getField('link');
+ }
+
+ /**
+ * Returns the users birthday, if available.
+ *
+ * @return \DateTime|null
+ */
+ public function getBirthday()
+ {
+ return $this->getField('birthday');
+ }
+
+ /**
+ * Returns the current location of the user as a GraphPage.
+ *
+ * @return GraphPage|null
+ */
+ public function getLocation()
+ {
+ return $this->getField('location');
+ }
+
+ /**
+ * Returns the current location of the user as a GraphPage.
+ *
+ * @return GraphPage|null
+ */
+ public function getHometown()
+ {
+ return $this->getField('hometown');
+ }
+
+ /**
+ * Returns the current location of the user as a GraphUser.
+ *
+ * @return GraphUser|null
+ */
+ public function getSignificantOther()
+ {
+ return $this->getField('significant_other');
+ }
+
+ /**
+ * Returns the picture of the user as a GraphPicture
+ *
+ * @return GraphPicture|null
+ */
+ public function getPicture()
+ {
+ return $this->getField('picture');
+ }
+}