PHP RestApi
REST is an acronym for REpresentational State Transfer and an architectural style for distributed hypermedia systems.
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Samy\SimpleApi\Response Class Reference
Inheritance diagram for Samy\SimpleApi\Response:
Samy\RestApi\AbstractResponse Samy\SimpleApi\ResponseInterface

Public Member Functions

 isSuccess ()
 
 withSuccess (bool $Success)
 
 getData ()
 
 withData (mixed $Data)
 
 getMessages ()
 
 addMessage (string $Type, string $Text, mixed $Data=null)
 
 cleanMessages ()
 
 hasLink (string $Name)
 
 getLinks ()
 
 getLink (string $Name, string $Default="")
 
 withLink (string $Name, string $Url)
 
 withoutLink (string $Name)
 
 cleanLinks ()
 
 withBody ($StreamInterface)
 
 getBody ()
 
- Public Member Functions inherited from Samy\RestApi\AbstractResponse
 parse (ResponseInterface $ResponseInterface)
 
- Public Member Functions inherited from Samy\SimpleApi\ResponseInterface
 isSuccess ()
 
 withSuccess (bool $Success)
 
 getData ()
 
 withData (mixed $Data)
 
 getMessages ()
 
 addMessage (string $Type, string $Text, mixed $Data=null)
 
 cleanMessages ()
 
 hasLink (string $Name)
 
 getLinks ()
 
 getLink (string $Name, string $Default="")
 
 withLink (string $Name, string $Url)
 
 withoutLink (string $Name)
 
 cleanLinks ()
 
 getError ()
 
 withError (string $Error)
 
 getErrorDescription ()
 
 withErrorDescription (string $ErrorDescription)
 
 getErrorUri ()
 
 withErrorUri (string $ErrorUri)
 

Protected Attributes

 $success = false
 
 $data = null
 
 $message = array()
 
 $link = array()
 

Detailed Description

Simple SimpleApi Response implementation.

Member Function Documentation

◆ addMessage()

Samy\SimpleApi\Response::addMessage ( string  $Type,
string  $Text,
mixed  $Data = null 
)

Return an instance with added message.

Parameters
[in]string$TypeMessage type
[in]string$TextMessage text
[in]mixed$DataMessage data
Returns
static

Implements Samy\SimpleApi\ResponseInterface.

◆ cleanLinks()

Samy\SimpleApi\Response::cleanLinks ( )

Return an instance without any link.

Returns
static

Implements Samy\SimpleApi\ResponseInterface.

◆ cleanMessages()

Samy\SimpleApi\Response::cleanMessages ( )

Return an instance without any messages.

Returns
static

Implements Samy\SimpleApi\ResponseInterface.

◆ getBody()

Samy\SimpleApi\Response::getBody ( )

Overwrite Message body.

Returns
StreamInterface Returns the body as a stream.

◆ getData()

Samy\SimpleApi\Response::getData ( )

Retrieve provided data.

Returns
mixed

Implements Samy\SimpleApi\ResponseInterface.

◆ getLink()

Samy\SimpleApi\Response::getLink ( string  $Name,
string  $Default = "" 
)

Retrieve a link url by the given case-insensitive name.

Parameters
[in]string$NameLink name
[in]string$DefaultLink default if not exists
Returns
string

Implements Samy\SimpleApi\ResponseInterface.

◆ getLinks()

Samy\SimpleApi\Response::getLinks ( )

Retrieve all provided links.

Returns
array<string, string>

Implements Samy\SimpleApi\ResponseInterface.

◆ getMessages()

Samy\SimpleApi\Response::getMessages ( )

Retrieve all provided messages.

Returns
array<array<string, mixed>>

Implements Samy\SimpleApi\ResponseInterface.

◆ hasLink()

Samy\SimpleApi\Response::hasLink ( string  $Name)

Checks if a link exists by the given case-insensitive name.

Parameters
[in]string$NameLink name
Returns
bool

Implements Samy\SimpleApi\ResponseInterface.

◆ isSuccess()

Samy\SimpleApi\Response::isSuccess ( )

Retrieve provided success status.

Returns
bool

Implements Samy\SimpleApi\ResponseInterface.

◆ withBody()

Samy\SimpleApi\Response::withBody (   $StreamInterface)

Overwrite Psr7 withBody.

Parameters
[in]mixed$StreamInterfaceBody.
Returns
static

◆ withData()

Samy\SimpleApi\Response::withData ( mixed  $Data)

Return an instance with provided data.

Parameters
[in]mixed$DataData
Returns
static

Implements Samy\SimpleApi\ResponseInterface.

◆ withLink()

Samy\SimpleApi\Response::withLink ( string  $Name,
string  $Url 
)

Return an instance with the specified link.

Parameters
[in]string$NameLink name
[in]string$UrlLink valid url
Returns
static

Implements Samy\SimpleApi\ResponseInterface.

◆ withoutLink()

Samy\SimpleApi\Response::withoutLink ( string  $Name)

Return an instance without the specified link.

Parameters
[in]string$NameLink name
Returns
static

Implements Samy\SimpleApi\ResponseInterface.

◆ withSuccess()

Samy\SimpleApi\Response::withSuccess ( bool  $Success)

Return an instance with provided success status.

Parameters
[in]bool$SuccessSuccess status
Returns
static

Implements Samy\SimpleApi\ResponseInterface.

Member Data Documentation

◆ $data

Samy\SimpleApi\Response::$data = null
protected

describe data

◆ $link

Samy\SimpleApi\Response::$link = array()
protected

describe links

◆ $message

Samy\SimpleApi\Response::$message = array()
protected

describe messages

◆ $success

Samy\SimpleApi\Response::$success = false
protected

describe success status


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