Version 3 by Gavin
on Oct 03, 2006 00:06.

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (1)

View Page History
{code}

However, this approach to factory methods does not address one of the key stated goals above. Specifically, it fails to provide one of the benefits of convenience factories by eliminating the need for "switch" like constructs in userland. So if the developer must call a factory method with 3 arguments in one situation, but 4 arguments in another, instead of just loading up a $options PHP array with <keyword,value> pairs, the developer will need something like the switch statement described in the "convenience factories" section.

{code:title=How to Use funct_get_args() in Factory}<?php
echo '$foo = new PluginClass(1,2);'."\n";