Created
December 3, 2012 14:15
-
-
Save lstrojny/4195275 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
<?php | |
trait PrototypeContainerTrait | |
{ | |
public function __call($method, array $args) | |
{ | |
if (is_callable($this->$method)) { | |
return call_user_func_array($this->$method, $args); | |
} | |
} | |
} | |
class Foo | |
{ | |
use PrototypeContainerTrait; | |
} | |
$foo = new Foo(); | |
$foo->times = function($x, $y) { | |
return $x * $y; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment