Update to Kirby 4.7.0
This commit is contained in:
parent
02a9ab387c
commit
ba25a9a198
509 changed files with 26604 additions and 14872 deletions
|
@ -20,68 +20,50 @@ class Responder
|
|||
/**
|
||||
* Timestamp when the response expires
|
||||
* in Kirby's cache
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
protected $expires = null;
|
||||
protected int|null $expires = null;
|
||||
|
||||
/**
|
||||
* HTTP status code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $code = null;
|
||||
protected int|null $code = null;
|
||||
|
||||
/**
|
||||
* Response body
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $body = null;
|
||||
protected string|null $body = null;
|
||||
|
||||
/**
|
||||
* Flag that defines whether the current
|
||||
* response can be cached by Kirby's cache
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $cache = true;
|
||||
protected bool $cache = true;
|
||||
|
||||
/**
|
||||
* HTTP headers
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $headers = [];
|
||||
protected array $headers = [];
|
||||
|
||||
/**
|
||||
* Content type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = null;
|
||||
protected string|null $type = null;
|
||||
|
||||
/**
|
||||
* Flag that defines whether the current
|
||||
* response uses the HTTP `Authorization`
|
||||
* request header
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $usesAuth = false;
|
||||
protected bool $usesAuth = false;
|
||||
|
||||
/**
|
||||
* List of cookie names the response
|
||||
* relies on
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $usesCookies = [];
|
||||
protected array $usesCookies = [];
|
||||
|
||||
/**
|
||||
* Creates and sends the response
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
|
@ -91,10 +73,9 @@ class Responder
|
|||
/**
|
||||
* Setter and getter for the response body
|
||||
*
|
||||
* @param string|null $body
|
||||
* @return string|$this
|
||||
* @return $this|string|null
|
||||
*/
|
||||
public function body(string $body = null)
|
||||
public function body(string|null $body = null): static|string|null
|
||||
{
|
||||
if ($body === null) {
|
||||
return $this->body;
|
||||
|
@ -110,10 +91,9 @@ class Responder
|
|||
* by Kirby's cache
|
||||
* @since 3.5.5
|
||||
*
|
||||
* @param bool|null $cache
|
||||
* @return bool|$this
|
||||
*/
|
||||
public function cache(bool|null $cache = null)
|
||||
public function cache(bool|null $cache = null): bool|static
|
||||
{
|
||||
if ($cache === null) {
|
||||
// never ever cache private responses
|
||||
|
@ -134,10 +114,9 @@ class Responder
|
|||
* `Authorization` request header
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @param bool|null $usesAuth
|
||||
* @return bool|$this
|
||||
*/
|
||||
public function usesAuth(bool|null $usesAuth = null)
|
||||
public function usesAuth(bool|null $usesAuth = null): bool|static
|
||||
{
|
||||
if ($usesAuth === null) {
|
||||
return $this->usesAuth;
|
||||
|
@ -151,9 +130,6 @@ class Responder
|
|||
* Setter for a cookie name that is
|
||||
* used by the response
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function usesCookie(string $name): void
|
||||
{
|
||||
|
@ -168,7 +144,6 @@ class Responder
|
|||
* names the response relies on
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @param array|null $usesCookies
|
||||
* @return array|$this
|
||||
*/
|
||||
public function usesCookies(array|null $usesCookies = null)
|
||||
|
@ -233,10 +208,9 @@ class Responder
|
|||
/**
|
||||
* Setter and getter for the status code
|
||||
*
|
||||
* @param int|null $code
|
||||
* @return int|$this
|
||||
*/
|
||||
public function code(int $code = null)
|
||||
public function code(int|null $code = null)
|
||||
{
|
||||
if ($code === null) {
|
||||
return $this->code;
|
||||
|
@ -248,8 +222,6 @@ class Responder
|
|||
|
||||
/**
|
||||
* Construct response from an array
|
||||
*
|
||||
* @param array $response
|
||||
*/
|
||||
public function fromArray(array $response): void
|
||||
{
|
||||
|
@ -266,7 +238,6 @@ class Responder
|
|||
/**
|
||||
* Setter and getter for a single header
|
||||
*
|
||||
* @param string $key
|
||||
* @param string|false|null $value
|
||||
* @param bool $lazy If `true`, an existing header value is not overridden
|
||||
* @return string|$this
|
||||
|
@ -293,10 +264,9 @@ class Responder
|
|||
/**
|
||||
* Setter and getter for all headers
|
||||
*
|
||||
* @param array|null $headers
|
||||
* @return array|$this
|
||||
*/
|
||||
public function headers(array $headers = null)
|
||||
public function headers(array|null $headers = null)
|
||||
{
|
||||
if ($headers === null) {
|
||||
$injectedHeaders = [];
|
||||
|
@ -333,10 +303,9 @@ class Responder
|
|||
/**
|
||||
* Shortcut to configure a json response
|
||||
*
|
||||
* @param array|null $json
|
||||
* @return string|$this
|
||||
*/
|
||||
public function json(array $json = null)
|
||||
public function json(array|null $json = null)
|
||||
{
|
||||
if ($json !== null) {
|
||||
$this->body(json_encode($json));
|
||||
|
@ -348,12 +317,12 @@ class Responder
|
|||
/**
|
||||
* Shortcut to create a redirect response
|
||||
*
|
||||
* @param string|null $location
|
||||
* @param int|null $code
|
||||
* @return $this
|
||||
*/
|
||||
public function redirect(string|null $location = null, int|null $code = null)
|
||||
{
|
||||
public function redirect(
|
||||
string|null $location = null,
|
||||
int|null $code = null
|
||||
) {
|
||||
$location = Url::to($location ?? '/');
|
||||
$location = Url::unIdn($location);
|
||||
|
||||
|
@ -364,11 +333,8 @@ class Responder
|
|||
|
||||
/**
|
||||
* Creates and returns the response object from the config
|
||||
*
|
||||
* @param string|null $body
|
||||
* @return \Kirby\Cms\Response
|
||||
*/
|
||||
public function send(string $body = null)
|
||||
public function send(string|null $body = null): Response
|
||||
{
|
||||
if ($body !== null) {
|
||||
$this->body($body);
|
||||
|
@ -380,8 +346,6 @@ class Responder
|
|||
/**
|
||||
* Converts the response configuration
|
||||
* to an array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
|
@ -399,10 +363,9 @@ class Responder
|
|||
/**
|
||||
* Setter and getter for the content type
|
||||
*
|
||||
* @param string|null $type
|
||||
* @return string|$this
|
||||
*/
|
||||
public function type(string $type = null)
|
||||
public function type(string|null $type = null)
|
||||
{
|
||||
if ($type === null) {
|
||||
return $this->type;
|
||||
|
@ -423,10 +386,6 @@ class Responder
|
|||
* is actually used/relied on by the response
|
||||
* @since 3.7.0
|
||||
* @internal
|
||||
*
|
||||
* @param bool $usesAuth
|
||||
* @param array $usesCookies
|
||||
* @return bool
|
||||
*/
|
||||
public static function isPrivate(bool $usesAuth, array $usesCookies): bool
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue