SimpleApi Response

Implementation SimpleApi Response instance.

$response = new Response();

isSuccess

Retrieve provided success status.

$is_success = $response->isSuccess();

withSuccess

Return an instance with provided success status.

$response = $response->withSuccess($is_success);

getData

Retrieve provided data.

$data = $response->getData();

withData

Return an instance with provided data.

$response = $response->withData($data);

getMessages

Retrieve all provided messages.

$messages = $response->getMessages();

addMessage

Return an instance with added message.

$response = $response->addMessage($type, $text, $data = null);

cleanMessages

Return an instance without any messages.

$response = $response->cleanMessages();

hasLink

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

$has_link = $response->hasLink($name);

getLinks

Retrieve all provided links.

$links = $response->getLinks();

getLink

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

$link = $response->getLink($name, $default = "");

withLink

Return an instance with the specified link.

$response = $response->withLink($name, $url);

withoutLink

Return an instance without the specified link.

$response = $response->withoutLink($name);

cleanLinks

Return an instance without any link.

$response = $response->cleanLinks();

getError

Retrieve provided error parameter.

$error = $response->getError();

withError

Return an instance with provided error parameter.

$response = $response->withError($error);

getErrorDescription

Retrieve provided error description.

$error_description = $response->getErrorDescription();

withErrorDescription

Return an instance with provided error description.

$response = $response->withErrorDescription($error_description);

getErrorUri

Retrieve provided error uri.

$error_uri = $response->getErrorUri();

withErrorUri

Return an instance with provided error uri.

$response = $response->withErrorUri($error_uri);

parse

Return an instance with parsed PSR-7 response interface.

$response = $response->parse($psr7_response_interface);