Skip to content

Instantly share code, notes, and snippets.

@DarkGhostHunter
Created July 9, 2020 04:44
Show Gist options
  • Save DarkGhostHunter/0a4b5e33dc54eb927182eb03d91c5e3d to your computer and use it in GitHub Desktop.
Save DarkGhostHunter/0a4b5e33dc54eb927182eb03d91c5e3d to your computer and use it in GitHub Desktop.
Container class to pass through the next method.
<?php
class Container
{
protected $target;
protected $value;
public function __construct($target, $value)
{
$this->target = $target;
$this->value = $value;
}
public function __call($method, $arguments)
{
if ($this->value) {
$this->{$method}(...$arguments);
}
return $this->target;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment