. */ /** * Defines an interface for creating a parser. */ class Parser_Factory { /** * Creates a parser of the appropriate type. * * @param string $type The skeleton type * @param string $url The skeleton URL * @param boolean $cache Either to use the cache or not * @return Parser A parser for the specified skeleton */ public static function getParser($type, $url, $cache = true) { switch ($type) { case 'uwa': // UWA XHTML Widget require_once 'Parser/Uwa.php'; return new Parser_Uwa($url, $cache); break; default: // Exception throw new Exception('Unrecognized type.'); break; } } }