Re: Implementation of the --package option in PhD
| From: | Kalle Sommer Nielsen | Date: | Thu, 28 May 2009 16:19:05 +0000 |
| Subject: | Re: Implementation of the --package option in PhD | ||
| References: | 1 2 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969380451@lists.php.net to get a copy of this message | ||
2009/5/28 Hannes Magnusson <hannes.magnusson@gmail.com>:
>
>> 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
kalle@php.net