Source of file ProxyTrait.php
Size: 0,892 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/Proxy/ProxyTrait.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\Proxy; use Bluz\Common\Singleton; /** * ProxyTrait * * @package Bluz\Proxy * @author Anton Shevchuk */ trait ProxyTrait { use Singleton; /** * Set or replace instance * * @param mixed $instance * * @return void */ public static function setInstance($instance) { static::$instance = $instance; } /** * Handle dynamic, static calls to the object. * * @param string $method * @param array $args * * @return mixed */ public static function __callStatic($method, $args) { if ($instance = static::getInstance()) { return $instance->$method(...$args); } return false; } } |