Upgrade to 4.0.0

This commit is contained in:
Bastian Allgeier
2023-11-28 09:33:56 +01:00
parent f96b96af76
commit 3b0b6546ca
480 changed files with 21371 additions and 13327 deletions

View File

@@ -4,7 +4,6 @@ namespace Kirby\Http;
use Kirby\Cms\App;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Toolkit\Properties;
use SensitiveParameter;
use Throwable;
@@ -19,8 +18,6 @@ use Throwable;
*/
class Uri
{
use Properties;
/**
* Cache for the current Uri object
*/
@@ -29,32 +26,32 @@ class Uri
/**
* The fragment after the hash
*/
protected string|false|null $fragment = null;
protected string|false|null $fragment;
/**
* The host address
*/
protected string|null $host = null;
protected string|null $host;
/**
* The optional password for basic authentication
*/
protected string|false|null $password = null;
protected string|false|null $password;
/**
* The optional list of params
*/
protected Params|null $params = null;
protected Params $params;
/**
* The optional path
*/
protected Path|null $path = null;
protected Path $path;
/**
* The optional port number
*/
protected int|false|null $port = null;
protected int|false|null $port;
/**
* All original properties
@@ -64,44 +61,25 @@ class Uri
/**
* The optional query string without leading ?
*/
protected Query|null $query = null;
protected Query $query;
/**
* https or http
*/
protected string|null $scheme = 'http';
protected string|null $scheme;
/**
* Supported schemes
*/
protected static array $schemes = ['http', 'https', 'ftp'];
protected bool $slash = false;
protected bool $slash;
/**
* The optional username for basic authentication
*/
protected string|false|null $username = null;
/**
* Magic caller to access all properties
*/
public function __call(string $property, array $arguments = [])
{
return $this->$property ?? null;
}
/**
* Make sure that cloning also clones
* the path and query objects
*/
public function __clone()
{
$this->path = clone $this->path;
$this->query = clone $this->query;
$this->params = clone $this->params;
}
/**
* Creates a new URI object
*
@@ -122,7 +100,36 @@ class Uri
$props = static::parsePath($props);
}
$this->setProperties($this->props = $props);
$this->props = $props;
$this->setFragment($props['fragment'] ?? null);
$this->setHost($props['host'] ?? null);
$this->setParams($props['params'] ?? null);
$this->setPassword($props['password'] ?? null);
$this->setPath($props['path'] ?? null);
$this->setPort($props['port'] ?? null);
$this->setQuery($props['query'] ?? null);
$this->setScheme($props['scheme'] ?? 'http');
$this->setSlash($props['slash'] ?? false);
$this->setUsername($props['username'] ?? null);
}
/**
* Magic caller to access all properties
*/
public function __call(string $property, array $arguments = [])
{
return $this->$property ?? null;
}
/**
* Make sure that cloning also clones
* the path and query objects
*/
public function __clone()
{
$this->path = clone $this->path;
$this->query = clone $this->query;
$this->params = clone $this->params;
}
/**
@@ -416,7 +423,7 @@ class Uri
{
$array = [];
foreach ($this->propertyData as $key => $value) {
foreach ($this->props as $key => $value) {
$value = $this->$key;
if (is_object($value) === true) {