Created
January 9, 2014 14:24
-
-
Save spolischook/8334864 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 | |
| class Dto | |
| { | |
| public $foo; | |
| public $bar; | |
| public $baz; | |
| } | |
| class Obj | |
| { | |
| protected $foo = 'foo'; | |
| protected $bar = 'bar'; | |
| public function getFoo() {return $this->foo;} | |
| public function getBar() {return $this->bar;} | |
| } | |
| $obj = new Obj(); | |
| $getter = function () { | |
| return get_object_vars($this); | |
| }; | |
| $getVars = $getter->bindTo($obj, $obj); | |
| var_dump( get_object_vars($obj)); | |
| var_dump($getVars()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment