Upgrade to 3.9.2
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace Kirby\Filesystem;
|
||||
|
||||
use Kirby\Cms\FileModifications;
|
||||
use Kirby\Cms\HasMethods;
|
||||
use Kirby\Exception\BadMethodCallException;
|
||||
|
||||
/**
|
||||
* Anything in your public path can be converted
|
||||
@@ -20,6 +22,7 @@ class Asset
|
||||
{
|
||||
use IsFile;
|
||||
use FileModifications;
|
||||
use HasMethods;
|
||||
|
||||
/**
|
||||
* Relative file path
|
||||
@@ -38,6 +41,31 @@ class Asset
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic caller for asset methods
|
||||
*
|
||||
* @throws \Kirby\Exception\BadMethodCallException
|
||||
*/
|
||||
public function __call(string $method, array $arguments = [])
|
||||
{
|
||||
// public property access
|
||||
if (isset($this->$method) === true) {
|
||||
return $this->$method;
|
||||
}
|
||||
|
||||
// asset method proxy
|
||||
if (method_exists($this->asset(), $method)) {
|
||||
return $this->asset()->$method(...$arguments);
|
||||
}
|
||||
|
||||
// asset methods
|
||||
if ($this->hasMethod($method)) {
|
||||
return $this->callMethod($method, $arguments);
|
||||
}
|
||||
|
||||
throw new BadMethodCallException('The method: "' . $method . '" does not exist');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a unique id for the asset
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user