first version
This commit is contained in:
31
kirby/src/Toolkit/Facade.php
Executable file
31
kirby/src/Toolkit/Facade.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Kirby\Toolkit;
|
||||
|
||||
/**
|
||||
* Laravel-style static facades
|
||||
* for class instances
|
||||
*/
|
||||
abstract class Facade
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns the instance that should be
|
||||
* available statically
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract protected static function instance();
|
||||
|
||||
/**
|
||||
* Proxy for all public instance calls
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public static function __callStatic(string $method, array $args = null)
|
||||
{
|
||||
return static::instance()->$method(...$args);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user