2009/5/28 Hannes Magnusson <[email protected]>: > >> abstract class PhDFormatFactory { >> abstract public function createXhtmlFormat(); >> abstract public function createBigXhtmlFormat(); >> abstract public function createPDFFormat(); >> abstract public function createManpageFormat(); >> abstract public function createPHPFormat(); > > This feels a bit dangerous. > What if we add a new format in later versions of PhD? That would break > _all_ existing packages because they would get "Class foobar contains > 1 abstract method and must therefore be declared abstract or implement > the remaining methods (PhDFormatFactory::createNewFormat)". > > Maybe simply have the class abstract, but implementing dummy methods > (trigger_error("This format is not supported by this package", > E_USER_ERROR)) would solve it?
I think method overloading could come in handy here, its abit dirty but it should do the job. > > -Hannes > -- regrads, Kalle Sommer Nielsen [email protected]
