Last active
January 17, 2020 22:59
-
-
Save DarkGhostHunter/c3d858fcab3c5019c7c599105ca02485 to your computer and use it in GitHub Desktop.
Infinite tapping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Helpers; | |
| use Illuminate\Support\Str; | |
| use Illuminate\Support\HigherOrderTapProxy; | |
| class InfiniteHigherOrderTapProxy extends HigherOrderTapProxy | |
| { | |
| /** | |
| * Dynamically pass method calls to the target. | |
| * | |
| * @param string $method | |
| * @param array $parameters | |
| * @return mixed | |
| */ | |
| public function __call($method, $parameters) | |
| { | |
| if (Str::endsWith('AndUntap', $method)) { | |
| return $this->target->{substr($method, 0, -8)}(...$parameters); | |
| } | |
| parent::__call($method, $parameters); | |
| return $this; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment