This commit is contained in:
2026-02-26 14:39:05 +08:00
parent d098b293a4
commit a2138bdd3b
5 changed files with 1407 additions and 1419 deletions
File diff suppressed because it is too large Load Diff
+10 -52
View File
@@ -23,7 +23,7 @@ class Message extends Component implements MessageInterface
private array $headers = [];
/**
/**
* @var StreamInterface
*/
public StreamInterface $stream;
@@ -31,7 +31,13 @@ class Message extends Component implements MessageInterface
/**
* @var array
*/
private array $cookieParams = [];
public array $cookieParams = [];
/**
* @var array
*/
public array $data = [];
/**
@@ -45,24 +51,7 @@ class Message extends Component implements MessageInterface
}
/**
* Retrieve cookies.
*
* Retrieves cookies sent by the client to the server.
*
* The data MUST be compatible with the structure of the $_COOKIE
* superglobal.
*
* @return array
*/
public function getCookieParams(): array
{
// TODO: Implement getCookieParams() method.
return $this->cookieParams;
}
/**
/**
* Return an instance with the specified cookies.
*
* The data IS NOT REQUIRED to come from the $_COOKIE superglobal, but MUST
@@ -120,38 +109,7 @@ class Message extends Component implements MessageInterface
return $this;
}
/**
* Retrieves all message header values.
*
* The keys represent the header name as it will be sent over the wire, and
* each value is an array of strings associated with the header.
*
* // Represent the headers as a string
* foreach ($message->getHeaders() as $name => $values) {
* echo $name . ": " . implode(", ", $values);
* }
*
* // Emit headers iteratively:
* foreach ($message->getHeaders() as $name => $values) {
* foreach ($values as $value) {
* header(sprintf('%s: %s', $name, $value), false);
* }
* }
*
* While header names are not case-sensitive, getHeaders() will preserve the
* exact case in which headers were originally specified.
*
* @return string[][] Returns an associative array of the message's headers. Each
* key MUST be a header name, and each value MUST be an array of strings
* for that header.
*/
public function getHeaders(): array
{
// TODO: Implement getHeaders() method.
return $this->headers;
}
/**
/**
* Checks if a header exists by the given case-insensitive name.
*
* @param string $name Case-insensitive header field name.