1
0
mirror of https://github.com/php/phd.git synced 2026-03-24 15:12:18 +01:00
Files
archived-phd/phpdotnet/phd/Format/Factory.php
Moacir de Oliveira Miranda Júnior d9812f0c4c Class PhDFormatFactory added
2009-05-28 19:29:39 +00:00

30 lines
907 B
PHP

<?php
abstract class PhDFormatFactory {
public function createXhtmlFormat() {
trigger_error("This format is not supported by this package", E_USER_ERROR);
}
public function createBigXhtmlFormat() {
trigger_error("This format is not supported by this package", E_USER_ERROR);
}
public function createPHPFormat() {
trigger_error("This format is not supported by this package", E_USER_ERROR);
}
public static final function createFactory() {
global $ROOT;
$package = PhDConfig::package();
$classname = "{$package}Factory";
require_once $ROOT . "/packages/$package/$classname.class.php";
$factory = new $classname();
if (!($factory instanceof PhDFormatFactory)) {
throw new Exception("All Factories must inherit PhDFormatFactory");
}
return $factory;
}
}
?>