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

@@ -27,18 +27,19 @@ class Asset
/**
* Relative file path
*/
protected string|null $path = null;
protected string|null $path;
/**
* Creates a new Asset object for the given path.
*/
public function __construct(string $path)
{
$this->setProperties([
'path' => dirname($path),
'root' => $this->kirby()->root('index') . '/' . $path,
'url' => $this->kirby()->url('base') . '/' . $path
]);
$this->root = $this->kirby()->root('index') . '/' . $path;
$this->url = $this->kirby()->url('base') . '/' . $path;
$path = dirname($path);
$this->path = $path === '.' ? '' : $path;
}
/**
@@ -46,7 +47,7 @@ class Asset
*
* @throws \Kirby\Exception\BadMethodCallException
*/
public function __call(string $method, array $arguments = [])
public function __call(string $method, array $arguments = []): mixed
{
// public property access
if (isset($this->$method) === true) {
@@ -114,15 +115,4 @@ class Asset
{
return $this->path;
}
/**
* Setter for the path
*
* @return $this
*/
protected function setPath(string $path): static
{
$this->path = $path === '.' ? '' : $path;
return $this;
}
}