Created
May 16, 2013 00:24
-
-
Save varemenos/5588524 to your computer and use it in GitHub Desktop.
PHP - Basic OOP
This file contains 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 entry{ | |
private $id = -1; // required | |
private $title = ""; // required | |
private $author = -1; // required, author ID | |
private $excerpt = ""; // either turn title into excerpt or manually enter one | |
private $date = ""; // required | |
// #TODO | |
// post type interface? | |
// private $type = ""; | |
public function __get($property) { | |
if (property_exists($this, $property)) { | |
return $this->$property; | |
} | |
} | |
public function __set($property, $value) { | |
if (property_exists($this, $property)) { | |
$this->$property = $value; | |
} | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment