<?php
abstract class Person {
abstract public function name();
function __toString() {
return $this->name();
}
function a() {
return new What();
}
}
class Her extends Person {
public function name() {
return "girlFriend";
}
}
class You extends Person {
public function name() {
return "you";
}
}
class Understand {
private $y, $i;
function __construct(Person $y) {
$this->y = $y;
$this->i = "";
}
function a() {
return new What($this->y, $this->i);
}
function get() {
while ($x = mt_rand(0, 5)) {
$this->i .= $x;
}
return $this;
}
}
class What {
private $i, $y;
function __construct(Person $y, $i) {
$this->i = $i;
$this->y = $y;
}
function girlFriend(Person $her) {
throw new NullBabeException(sprintf("%s is Needed ASAP Found %s issues with %s ",
$her,
number_format((int)$this->i),
$this->y
), E_CORE_WARNING);
}
}
class NullBabeException extends Exception {
function __construct($m){
parent::__construct(sprintf("<h1>%s</h1>",$m));
}
}
try {
if ($you = new Understand(new You())) {
$you->get()->a()->girlFriend(new Her());
}
} catch ( NullBabeException $e ) {
echo $e->getMessage();
}
?>
<?php