Created
October 2, 2015 21:54
-
-
Save md2perpe/ce71b4509139cc1f9f1a to your computer and use it in GitHub Desktop.
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
class Safe | |
{ | |
protected $value; | |
public function __construct($value) { $this->value = $value; } | |
public function __call($method, $args) | |
{ | |
if (is_object($this->value) && method_exists($this->value, $method)) { | |
return new self(call_user_func_array([$this->value, $method], $args); | |
} | |
return new self(null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment