Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 16b8df159a | |||
| 83f6dc721a | |||
| a2138bdd3b |
@@ -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;
|
||||
|
||||
+545
-536
File diff suppressed because it is too large
Load Diff
+25
-50
@@ -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
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -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])) {
|
||||
|
||||
Reference in New Issue
Block a user