Skip to content

Instantly share code, notes, and snippets.

@pensiero
Created March 24, 2014 16:56
Show Gist options
  • Save pensiero/9744383 to your computer and use it in GitHub Desktop.
Save pensiero/9744383 to your computer and use it in GitHub Desktop.
/**
* Magic getter to expose protected properties.
*
* @param string $property
* @return mixed
*/
public function __get($property) {
return $this->{'get'.ucfirst($property)}();
}
/**
* Magic setter to save protected properties.
* @param string $property
* @param mixed $value
*/
public function __set($property, $value) {
$this->{'set'.ucfirst($property)}($value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment