HigherOrderTapProxy.php 665B

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