12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- declare(strict_types=1);
- /**
- * This file is part of Hyperf.
- *
- * @link https://www.hyperf.io
- * @document https://hyperf.wiki
- * @contact group@hyperf.io
- * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
- */
- namespace Hyperf\Utils;
- class HigherOrderTapProxy
- {
- /**
- * The target being tapped.
- *
- * @var mixed
- */
- public $target;
- /**
- * Create a new tap proxy instance.
- *
- * @param mixed $target
- */
- public function __construct($target)
- {
- $this->target = $target;
- }
- /**
- * Dynamically pass method calls to the target.
- *
- * @param string $method
- * @param array $parameters
- * @return mixed
- */
- public function __call($method, $parameters)
- {
- $this->target->{$method}(...$parameters);
- return $this->target;
- }
- }
|