A Divine Framework

<?php ini_set('display_errors', 'true'); interface God {         public function bless(Human $who);         public function heal(Human $who);         public function save(Human $who); } class Human {         public $name;         public $health = 0;         public $abundance = 0;         public $saved = false;         public function __construct($name) {                 $this->name = $name;         }         public function __toString() {                 $out = "Hello there. I am $this->name. ";                 if($this->health > 0) {                         $out .= "I am healthy. ";                 }                 else {                         $out .= "I am sick. ";                 }                 if($this->abundance > 0) {                         $out .= "I am abundant. ";                 }                 else {                         $out .= "I am poor. ";                 }                 if($this->saved) {                         $out .= "I am going to Heaven!!";                 }                 else {                         $out .= "I am screwed.";                 }                 return $out;         }         public function __destruct() {                 echo $this->__toString();         } } class JesusChrist extends Human implements God {         public $health = 100;         public $abundance = 100;         public $saved = true; // duh         public static $savedCount = 0;         public function bless(Human $who) {                 $who->abundance++;         }         public function heal(Human $who) {                 $who->health++;         }         public function save(Human $who) {                 $who->saved = true;                 self::$savedCount++;         }         public function __toString() {                 $out = parent::__toString();                 return $out . 'And I have brought '.self::$savedCount.' people back to God.';         } } $JC = new JesusChrist('Jesus Christ'); $me = new Human('Mike G.'); $you = new Human('Daniel W.'); $other = new Human('John D.'); $JC->save($me); $JC->bless($me); $JC->heal($me); $JC->save($you); $JC->bless($you); $JC->heal($you); // Then we die and our destructors are called... ?>

This entry was posted on Thursday, June 21st, 2007 at 8:39 pm and is filed under Code, Humor, PHP. Both comments and pings are currently closed.

Comments are closed. Sorry.

Site Stuff

Pages

Projects

Archives

Categories