Last active
August 29, 2015 14:07
-
-
Save yitznewton/0dfcc01973158e4cf1d8 to your computer and use it in GitHub Desktop.
PHP pseudo-overload getter/setter
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 Foo | |
| { | |
| private $bar; | |
| public function bar($newBar = null) | |
| { | |
| if ($newBar !== null) { | |
| $this->bar = $newBar; | |
| } else { | |
| return $this->bar; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment