HigherOrderTapProxy.php
| 1 | <?php |
| 2 | |
| 3 | namespace IAWPSCOPED\Illuminate\Support; |
| 4 | |
| 5 | /** @internal */ |
| 6 | class HigherOrderTapProxy |
| 7 | { |
| 8 | /** |
| 9 | * The target being tapped. |
| 10 | * |
| 11 | * @var mixed |
| 12 | */ |
| 13 | public $target; |
| 14 | /** |
| 15 | * Create a new tap proxy instance. |
| 16 | * |
| 17 | * @param mixed $target |
| 18 | * @return void |
| 19 | */ |
| 20 | public function __construct($target) |
| 21 | { |
| 22 | $this->target = $target; |
| 23 | } |
| 24 | /** |
| 25 | * Dynamically pass method calls to the target. |
| 26 | * |
| 27 | * @param string $method |
| 28 | * @param array $parameters |
| 29 | * @return mixed |
| 30 | */ |
| 31 | public function __call($method, $parameters) |
| 32 | { |
| 33 | $this->target->{$method}(...$parameters); |
| 34 | return $this->target; |
| 35 | } |
| 36 | } |
| 37 |