Cheetah
Public Member Functions | Protected Attributes | List of all members
Facebook\FacebookResponse Class Reference
Inheritance diagram for Facebook\FacebookResponse:
Facebook\FacebookBatchResponse

Public Member Functions

 __construct (FacebookRequest $request, $body=null, $httpStatusCode=null, array $headers=[])
 
 getRequest ()
 
 getApp ()
 
 getAccessToken ()
 
 getHttpStatusCode ()
 
 getHeaders ()
 
 getBody ()
 
 getDecodedBody ()
 
 getAppSecretProof ()
 
 getETag ()
 
 getGraphVersion ()
 
 isError ()
 
 throwException ()
 
 makeException ()
 
 getThrownException ()
 
 decodeBody ()
 
 getGraphObject ($subclassName=null)
 
 getGraphNode ($subclassName=null)
 
 getGraphAlbum ()
 
 getGraphPage ()
 
 getGraphSessionInfo ()
 
 getGraphUser ()
 
 getGraphEvent ()
 
 getGraphGroup ()
 
 getGraphList ($subclassName=null, $auto_prefix=true)
 
 getGraphEdge ($subclassName=null, $auto_prefix=true)
 

Protected Attributes

 $httpStatusCode
 
 $headers
 
 $body
 
 $decodedBody = []
 
 $request
 
 $thrownException
 

Detailed Description

Definition at line 35 of file FacebookResponse.php.

Constructor & Destructor Documentation

◆ __construct()

Facebook\FacebookResponse::__construct ( FacebookRequest  $request,
  $body = null,
  $httpStatusCode = null,
array  $headers = [] 
)

Creates a new Response entity.

Parameters
FacebookRequest$request
string | null$body
int | null$httpStatusCode
array | null$headers

Definition at line 75 of file FacebookResponse.php.

Member Function Documentation

◆ decodeBody()

Facebook\FacebookResponse::decodeBody ( )

Convert the raw response into an array if possible.

Graph will return 2 types of responses:

  • JSON(P) Most responses from Graph are JSON(P)
  • application/x-www-form-urlencoded key/value pairs Happens on the /oauth/access_token endpoint when exchanging a short-lived access token for a long-lived access token
  • And sometimes nothing :/ but that'd be a bug.

Definition at line 234 of file FacebookResponse.php.

◆ getAccessToken()

Facebook\FacebookResponse::getAccessToken ( )

Return the access token that was used for this response.

Returns
string|null

Definition at line 110 of file FacebookResponse.php.

◆ getApp()

Facebook\FacebookResponse::getApp ( )

Return the FacebookApp entity used for this response.

Returns
FacebookApp

Definition at line 100 of file FacebookResponse.php.

◆ getAppSecretProof()

Facebook\FacebookResponse::getAppSecretProof ( )

Get the app secret proof that was used for this response.

Returns
string|null

Definition at line 160 of file FacebookResponse.php.

◆ getBody()

Facebook\FacebookResponse::getBody ( )

Return the raw body response.

Returns
string

Definition at line 140 of file FacebookResponse.php.

◆ getDecodedBody()

Facebook\FacebookResponse::getDecodedBody ( )

Return the decoded body response.

Returns
array

Definition at line 150 of file FacebookResponse.php.

◆ getETag()

Facebook\FacebookResponse::getETag ( )

Get the ETag associated with the response.

Returns
string|null

Definition at line 170 of file FacebookResponse.php.

◆ getGraphAlbum()

Facebook\FacebookResponse::getGraphAlbum ( )

Convenience method for creating a GraphAlbum collection.

Returns
\Facebook\GraphNodes\GraphAlbum
Exceptions
FacebookSDKException

Definition at line 299 of file FacebookResponse.php.

◆ getGraphEdge()

Facebook\FacebookResponse::getGraphEdge (   $subclassName = null,
  $auto_prefix = true 
)

Instantiate a new GraphEdge from response.

Parameters
string | null$subclassNameThe GraphNode subclass to cast list items to.
boolean$auto_prefixToggle to auto-prefix the subclass name.
Returns
\Facebook\GraphNodes\GraphEdge
Exceptions
FacebookSDKException

Definition at line 404 of file FacebookResponse.php.

◆ getGraphEvent()

Facebook\FacebookResponse::getGraphEvent ( )

Convenience method for creating a GraphEvent collection.

Returns
\Facebook\GraphNodes\GraphEvent
Exceptions
FacebookSDKException

Definition at line 355 of file FacebookResponse.php.

◆ getGraphGroup()

Facebook\FacebookResponse::getGraphGroup ( )

Convenience method for creating a GraphGroup collection.

Returns
\Facebook\GraphNodes\GraphGroup
Exceptions
FacebookSDKException

Definition at line 369 of file FacebookResponse.php.

◆ getGraphList()

Facebook\FacebookResponse::getGraphList (   $subclassName = null,
  $auto_prefix = true 
)

Instantiate a new GraphList from response.

Parameters
string | null$subclassNameThe GraphNode subclass to cast list items to.
boolean$auto_prefixToggle to auto-prefix the subclass name.
Returns
\Facebook\GraphNodes\GraphList
Exceptions
FacebookSDKException

Definition at line 389 of file FacebookResponse.php.

◆ getGraphNode()

Facebook\FacebookResponse::getGraphNode (   $subclassName = null)

Instantiate a new GraphNode from response.

Parameters
string | null$subclassNameThe GraphNode subclass to cast to.
Returns
\Facebook\GraphNodes\GraphNode
Exceptions
FacebookSDKException

Definition at line 285 of file FacebookResponse.php.

◆ getGraphObject()

Facebook\FacebookResponse::getGraphObject (   $subclassName = null)

Instantiate a new GraphObject from response.

Parameters
string | null$subclassNameThe GraphNode subclass to cast to.
Returns
\Facebook\GraphNodes\GraphObject
Exceptions
FacebookSDKException

Definition at line 271 of file FacebookResponse.php.

◆ getGraphPage()

Facebook\FacebookResponse::getGraphPage ( )

Convenience method for creating a GraphPage collection.

Returns
\Facebook\GraphNodes\GraphPage
Exceptions
FacebookSDKException

Definition at line 313 of file FacebookResponse.php.

◆ getGraphSessionInfo()

Facebook\FacebookResponse::getGraphSessionInfo ( )

Convenience method for creating a GraphSessionInfo collection.

Returns
\Facebook\GraphNodes\GraphSessionInfo
Exceptions
FacebookSDKException

Definition at line 327 of file FacebookResponse.php.

◆ getGraphUser()

Facebook\FacebookResponse::getGraphUser ( )

Convenience method for creating a GraphUser collection.

Returns
\Facebook\GraphNodes\GraphUser
Exceptions
FacebookSDKException

Definition at line 341 of file FacebookResponse.php.

◆ getGraphVersion()

Facebook\FacebookResponse::getGraphVersion ( )

Get the version of Graph that returned this response.

Returns
string|null

Definition at line 180 of file FacebookResponse.php.

◆ getHeaders()

Facebook\FacebookResponse::getHeaders ( )

Return the HTTP headers for this response.

Returns
array

Definition at line 130 of file FacebookResponse.php.

◆ getHttpStatusCode()

Facebook\FacebookResponse::getHttpStatusCode ( )

Return the HTTP status code for this response.

Returns
int

Definition at line 120 of file FacebookResponse.php.

◆ getRequest()

Facebook\FacebookResponse::getRequest ( )

Return the original request that returned this response.

Returns
FacebookRequest

Definition at line 90 of file FacebookResponse.php.

◆ getThrownException()

Facebook\FacebookResponse::getThrownException ( )

Returns the exception that was thrown for this request.

Returns
FacebookResponseException|null

Definition at line 218 of file FacebookResponse.php.

◆ isError()

Facebook\FacebookResponse::isError ( )

Returns true if Graph returned an error message.

Returns
boolean

Definition at line 190 of file FacebookResponse.php.

◆ makeException()

Facebook\FacebookResponse::makeException ( )

Instantiates an exception to be thrown later.

Definition at line 208 of file FacebookResponse.php.

◆ throwException()

Facebook\FacebookResponse::throwException ( )

Throws the exception.

Exceptions
FacebookSDKException

Definition at line 200 of file FacebookResponse.php.

Member Data Documentation

◆ $body

Facebook\FacebookResponse::$body
protected

Definition at line 50 of file FacebookResponse.php.

◆ $decodedBody

Facebook\FacebookResponse::$decodedBody = []
protected

Definition at line 55 of file FacebookResponse.php.

◆ $headers

Facebook\FacebookResponse::$headers
protected

Definition at line 45 of file FacebookResponse.php.

◆ $httpStatusCode

Facebook\FacebookResponse::$httpStatusCode
protected

Definition at line 40 of file FacebookResponse.php.

◆ $request

Facebook\FacebookResponse::$request
protected

Definition at line 60 of file FacebookResponse.php.

◆ $thrownException

Facebook\FacebookResponse::$thrownException
protected

Definition at line 65 of file FacebookResponse.php.


The documentation for this class was generated from the following file: