Php baby class

After months of insightful observation and analysis, I’ve come up with this php baby simulator.

  1. Class Baby extends Mom_and_Dad {
  2.  
  3. public $status
  4.  
  5. //[..]
  6.  
  7. function check_status() {
  8.  
  9. if( $this->status == "asleep") parent::enjoy_your_life_or_what_is_left()
  10.  
  11. else $everything = true;
  12.  
  13. if($everything) $this->cry();
  14.  
  15. }
  16.  
  17. function cry() {
  18.  
  19. $index = rand(1,4);
  20.  
  21. $volume = array('low', 'loud','louder','uber loud', "warn the sismologists it’s not an earthquake" )
  22.  
  23. echo $volume[$index];
  24.  
  25. }
  26.  
  27. }

//Beware the loop

while($parents->still_love_each_other_enough()) {

$newborn = new Baby;

}

(maybe I should refactor it using cakephp or at least the MVC pattern: I’d really love to have a BabiesController)

Be careful: due to inherent hardware limitations, the constructor of the Baby class takes a lot to complete (more or less, 9 months). Once instantiated, the new baby object takes a lot of resources (parent’s hardware is used a lot). Oh, and it sucks, literally.

(no, it’s not my baby in the cover image)