变更
This commit is contained in:
@@ -29,7 +29,7 @@ class ConstrictRequest extends Message implements RequestInterface, ServerReques
|
|||||||
|
|
||||||
private array $files = [];
|
private array $files = [];
|
||||||
private array $queryParams = [];
|
private array $queryParams = [];
|
||||||
private array $cookieParams = [];
|
|
||||||
private array $serverParams = [];
|
private array $serverParams = [];
|
||||||
|
|
||||||
|
|
||||||
@@ -211,45 +211,6 @@ class ConstrictRequest extends Message implements RequestInterface, ServerReques
|
|||||||
return $this->serverParams = [];
|
return $this->serverParams = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
* be compatible with the structure of $_COOKIE. Typically, this data will
|
|
||||||
* be injected at instantiation.
|
|
||||||
*
|
|
||||||
* This method MUST NOT update the related Cookie header of the request
|
|
||||||
* instance, nor related values in the server params.
|
|
||||||
*
|
|
||||||
* This method MUST be implemented in such a way as to retain the
|
|
||||||
* immutability of the message, and MUST return an instance that has the
|
|
||||||
* updated cookie values.
|
|
||||||
*
|
|
||||||
* @param array $cookies Array of key/value pairs representing cookies.
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function withCookieParams(array $cookies): static
|
|
||||||
{
|
|
||||||
// TODO: Implement withCookieParams() method.
|
|
||||||
$this->cookieParams = $cookies;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an instance with the specified cookies.
|
* Return an instance with the specified cookies.
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ class ConstrictResponse extends Message implements ResponseInterface
|
|||||||
|
|
||||||
|
|
||||||
private string $reasonPhrase;
|
private string $reasonPhrase;
|
||||||
private array $cookieParams;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,27 +89,6 @@ class ConstrictResponse extends Message implements ResponseInterface
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $cookies
|
|
||||||
* @return ResponseInterface
|
|
||||||
*/
|
|
||||||
public function withCookieParams(array $cookies): static
|
|
||||||
{
|
|
||||||
$this->cookieParams = $cookies;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getCookieParams(): array
|
|
||||||
{
|
|
||||||
return $this->cookieParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param object $response
|
* @param object $response
|
||||||
* @return void
|
* @return void
|
||||||
|
|||||||
@@ -27,6 +27,54 @@ class Message implements MessageInterface
|
|||||||
*/
|
*/
|
||||||
private StreamInterface $stream;
|
private StreamInterface $stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private array $cookieParams = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* be compatible with the structure of $_COOKIE. Typically, this data will
|
||||||
|
* be injected at instantiation.
|
||||||
|
*
|
||||||
|
* This method MUST NOT update the related Cookie header of the request
|
||||||
|
* instance, nor related values in the server params.
|
||||||
|
*
|
||||||
|
* This method MUST be implemented in such a way as to retain the
|
||||||
|
* immutability of the message, and MUST return an instance that has the
|
||||||
|
* updated cookie values.
|
||||||
|
*
|
||||||
|
* @param array $cookies Array of key/value pairs representing cookies.
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function withCookieParams(array $cookies): static
|
||||||
|
{
|
||||||
|
// TODO: Implement withCookieParams() method.
|
||||||
|
$this->cookieParams = $cookies;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the HTTP protocol version as a string.
|
* Retrieves the HTTP protocol version as a string.
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ class Server implements OnRequestInterface
|
|||||||
|
|
||||||
/** @var ConstrictResponse $PsrResponse */
|
/** @var ConstrictResponse $PsrResponse */
|
||||||
$PsrResponse = Context::set(ResponseInterface::class, new ConstrictResponse());
|
$PsrResponse = Context::set(ResponseInterface::class, new ConstrictResponse());
|
||||||
$PsrResponse->withContentType($response->contentType)->withCookieParams($cookie);
|
$PsrResponse->withContentType($response->contentType);
|
||||||
|
|
||||||
$serverRequest = (new ConstrictRequest())->withDataHeaders($request->getData())
|
$serverRequest = (new ConstrictRequest())->withDataHeaders($request->getData())
|
||||||
->withUri(Uri::parse($request))
|
->withUri(Uri::parse($request))
|
||||||
|
|||||||
Reference in New Issue
Block a user