- define: documentation ( source)
<?php define("CLI", !isset($_SERVER['HTTP_USER_AGENT']));
$lt = (CLI) ? "\r\n" : "<br />";
/**
* Abstract Surfer Class
*
* @package hangten
*/
abstract class Surfer
{
abstract public function rideWave($amplitude);
public function applyWax($waxType){
echo("Ahh, all waxed up with '".$waxType."', ready to go!" . $lt);
}
public function paddleOut(){
echo("Paddling...." . $lt);
}
public function screamShark(){
echo("SHARK!!" . $lt);
}
}
/**
* RookieSurfer Class
*
* This surfer is green and can barely surf =)
* @package hangten
*/
class RookieSurfer extends Surfer
{
public function rideWave($amplitude = 1){
echo("Trying.. Trying.. to ride a ".$amplitude."ft. wave, whew!" . $lt);
}
}
/**
* ProSurfer Class
*
* This surfer is crazy skilled!!
* @package hangten
*/
class ProSurfer extends Surfer
{
public function rideWave($amplitude = 8){
echo("Riding a ".$amplitude."ft. wave backwards doing a backflip!" . $lt);
}
public function killSharkWithBoard(){
echo("totally just sliced that shark in two, he's over it!! booya!" . $lt);
}
}
// Rookie Instantiation
$rookie = new RookieSurfer;
$rookie->applyWax("Candle Wax");
$rookie->paddleOut();
$rookie->rideWave(2);
$rookie->screamShark();
// Pro Instantiation
$pro = new ProSurfer;
$pro->applyWax("Sex Wax");
$pro->paddleOut();
$pro->rideWave(50);
$pro->killSharkWithBoard();