3 Commits

Author SHA1 Message Date
as2252258 16b8df159a eee 2026-04-17 13:56:30 +08:00
as2252258 83f6dc721a eee 2026-04-17 11:54:24 +08:00
as2252258 a2138bdd3b eee 2026-02-26 14:39:05 +08:00
5 changed files with 1422 additions and 1417 deletions
+12 -1
View File
@@ -20,10 +20,21 @@ interface AuthorizationInterface
public function getUniqueId(): string|int;
/**
* @return string
*/
public function getNickname(): string;
/**
* @return string
*/
public function getAvatar(): string;
/**
* @param string $key
* @param int $timeout
* @param int $timeout
* @return bool
*/
public function lock(string $key, int $timeout): bool;
File diff suppressed because it is too large Load Diff
+25 -50
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,24 @@ 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 array
*/
public function getHeaders(): array
{
return $this->headers;
}
/**
* @return array
*/
public function getCookieParams(): array
{
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 +126,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.
+839 -829
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -98,7 +98,7 @@ class Session
*/
private static function getSessionId(ServerRequestInterface $request): string
{
$cookies = $request->getCookieParams();
$cookies = $request->cookieParams;
// 从 Cookie 中获取 Session ID
if (isset($cookies[self::SESSION_NAME]) && !empty($cookies[self::SESSION_NAME])) {