class BlueHouse extends House{}
class RedHouse extends House{}
abstract class House
{
const RED= 1;
const BLUE= 2;
public static function getInstance($color)
{
switch($color)
{
case self::RED:
return new RedHouse();
break;
case self::BLUE:
return new BlueHouse();
break;
default :
throw new Exception('Undefined house\'s color');
break;
}
}
abstract function build();
abstract function demolition();
}