Skip to content

Commit

Permalink
Rename graphObjectMap to graphNodeMap
Browse files Browse the repository at this point in the history
  • Loading branch information
yguedidi committed Dec 6, 2017
1 parent 421f8ce commit 7cf460c
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Starting with version 5, the Facebook PHP SDK follows [SemVer](http:https://semver.org
- Removed functions `GraphNode::getPropertyNames`, `GraphEdge::getPropertyNames`
- Removed functions `GraphNode::getPropertyNames`, `GraphEdge::getPropertyNames`
- Removed functions `Response::getGraphObject`, `Response::getGraphList`
- Rename function `GraphNode::getObjectMap` to `GraphNode::getNodeMap`

## 5.x

Expand Down
2 changes: 1 addition & 1 deletion src/GraphNode/GraphAchievement.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GraphAchievement extends GraphNode
/**
* @var array maps object key names to Graph object types
*/
protected static $graphObjectMap = [
protected static $graphNodeMap = [
'from' => GraphUser::class,
'application' => GraphApplication::class,
];
Expand Down
2 changes: 1 addition & 1 deletion src/GraphNode/GraphAlbum.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class GraphAlbum extends GraphNode
/**
* @var array maps object key names to Graph object types
*/
protected static $graphObjectMap = [
protected static $graphNodeMap = [
'from' => GraphUser::class,
'place' => GraphPage::class,
];
Expand Down
2 changes: 1 addition & 1 deletion src/GraphNode/GraphEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GraphEvent extends GraphNode
/**
* @var array maps object key names to GraphNode types
*/
protected static $graphObjectMap = [
protected static $graphNodeMap = [
'cover' => GraphCoverPhoto::class,
'place' => GraphPage::class,
'picture' => GraphPicture::class,
Expand Down
2 changes: 1 addition & 1 deletion src/GraphNode/GraphGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GraphGroup extends GraphNode
/**
* @var array maps object key names to GraphNode types
*/
protected static $graphObjectMap = [
protected static $graphNodeMap = [
'cover' => GraphCoverPhoto::class,
'venue' => GraphLocation::class,
];
Expand Down
8 changes: 4 additions & 4 deletions src/GraphNode/GraphNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GraphNode extends Collection
/**
* @var array maps object key names to Graph object types
*/
protected static $graphObjectMap = [];
protected static $graphNodeMap = [];

/**
* Init this Graph object.
Expand Down Expand Up @@ -184,12 +184,12 @@ public function castToBirthday($value)
}

/**
* Getter for $graphObjectMap.
* Getter for $graphNodeMap.
*
* @return array
*/
public static function getObjectMap()
public static function getNodeMap()
{
return static::$graphObjectMap;
return static::$graphNodeMap;
}
}
8 changes: 4 additions & 4 deletions src/GraphNode/GraphNodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ public function safelyMakeGraphNode(array $data, $subclassName = null)
foreach ($data as $k => $v) {
// Array means could be recurable
if (is_array($v)) {
// Detect any smart-casting from the $graphObjectMap array.
// Detect any smart-casting from the $graphNodeMap 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]
$graphNodeMap = $subclassName::getNodeMap();
$objectSubClass = isset($graphNodeMap[$k])
? $graphNodeMap[$k]
: null;

// Could be a GraphEdge or GraphNode
Expand Down
2 changes: 1 addition & 1 deletion src/GraphNode/GraphPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GraphPage extends GraphNode
/**
* @var array maps object key names to Graph object types
*/
protected static $graphObjectMap = [
protected static $graphNodeMap = [
'best_page' => GraphPage::class,
'global_brand_parent_page' => GraphPage::class,
'location' => GraphLocation::class,
Expand Down
2 changes: 1 addition & 1 deletion src/GraphNode/GraphUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GraphUser extends GraphNode
/**
* @var array maps object key names to Graph object types
*/
protected static $graphObjectMap = [
protected static $graphNodeMap = [
'hometown' => GraphPage::class,
'location' => GraphPage::class,
'significant_other' => GraphUser::class,
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/MyFooGraphNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class MyFooGraphNode extends GraphNode
{
protected static $graphObjectMap = [
protected static $graphNodeMap = [
'foo_object' => MyFooSubClassGraphNode::class,
];
}

0 comments on commit 7cf460c

Please sign in to comment.