You are not programming OOP, you created a function and named it a class.
$dave = Horse::get('Dave'); // new Horse('Dave'); => *MAGIC*
$dude = Horse::get('Dude');
$evan = Horse::get('Evan');
$jill = Horse::get('Jill');
$flex = Horse::get('Flex');
$race = new Race($dave, $dude, $evan, $jill, $flex); // contestants: get ready! set!
$race->start(); // go!
print_r($race->getResults()); // there goes my money!
The code for this would look something similar to this:
class Horse {
private function __construct($name, $strength, $speed, $agility) {/*assign variables*/}
public static function get($name) {
// retrieve Horse from DB, return new instance of self
return new self($row->name, $row->strength, $row->speed, $row->agility);
}
}
class Race {
public function __construct() {
$this->_addContestants(func_get_args());
//..
}
public function start() {/*let's race!*/}
public function getResults() {/*race results*/}
}