36 lines
866 B
PHP
36 lines
866 B
PHP
<?php
|
|
|
|
namespace php;
|
|
|
|
|
|
/**
|
|
* A response from the server to a request.
|
|
*/
|
|
class Response
|
|
{
|
|
/**
|
|
* @var mixed The payload corresponding to the client's query.
|
|
*/
|
|
public mixed $payload;
|
|
/**
|
|
* @var bool `true` if and only if the request was fully completed.
|
|
*/
|
|
public bool $satisfied;
|
|
|
|
|
|
/**
|
|
* Constructs a new response.
|
|
*
|
|
* If `satisfied` is `false`, then `payload` must be an array containing at least the strings `target` and
|
|
* `message`. Otherwise, `payload` may be anything.
|
|
*
|
|
* @param mixed $payload the payload corresponding to the client's query
|
|
* @param bool $satisfied `true` if and only if the request was fully completed
|
|
*/
|
|
public function __construct(mixed $payload, bool $satisfied)
|
|
{
|
|
$this->payload = $payload;
|
|
$this->satisfied = $satisfied;
|
|
}
|
|
}
|