Bertrand Mansion [2005-07-17 08:57 UTC]First impressions:
- Instance variables should use camelCase IMO.
- Index types should be setable on a per question basis.
- the constructor and singleton() should accept an option/configuration array.
- addQuestion should accept be 3 parameters max, the third one being an option array (to prevent future API problems)
- maybe do the same with addRule(), unless you are sure it won't change.
- It should be possible to use a previous answer to setup the next questions. A page system like in QFC might work.
- What about an xml wizard definition ?
- Make sure every text is localizable.
- addGroupRule() is empty
I haven't run the examples yet, I'll let you know later.
Clay Loveless [2005-07-31 20:33 UTC]Thanks, Bertrand. Regarding your points:
-camelCase instance variables
I have looked through the CS guidelines, and I am familiar with the camelCase rule for method names. However, there is no rule that I could find regarding variable names. So, I've written variables_like_this and methodsLikeThis to make it very easy to tell them apart at a glance.
- Index types settable on per-question basis
This is a good idea, and I just realized I forgot to put it in alpha2. I will add this feature for alpha3.
- option/config arrays for constructor, singleton() and addQuestion()
Great idea, done!
- previous answer to setup next question
Unless I misunderstand you, this is already possible with the setNextQuestion methods. Both the Question and Answer classes have this method, allowing for a default next question, and the setting of a specific next question based on a specific answer.
- xml wizard definition
Good idea, I'm planning on this for a future release. I'd like to make the format compatible with the XML format used in defining post-install scripts in PEAR 1.4.0.
- localizable text
- addGroupRule empty
This is still on my to-do list. Working on a good way to handle this, and will include it in the next alpha release.
Thanks again, Bertrand!
Markus Tacker [2005-11-02 15:29 UTC]This code
$Console =& Console_Wizard::singleton();
$Console->addQuestion('tracker', 'Which tracker would you like to use?');
echo '<pre>'; print_r($Console->exportValues()); echo '</pre>';
produces these errors on PHP 5.1.0RC3
Notice: Undefined variable: answer in /usr/share/php/Console/Wizard/Question.php on line 579
Notice: Undefined variable: answer in /usr/share/php/Console/Wizard/Question.php on line 595
Notice: Undefined index: in /usr/share/php/Console/Wizard/Question.php on line 595
Fatal error: Call to a member function getNextQuestion() on a non-object in /usr/share/php/Console/Wizard/Question.php on line 595
Laurent Laville [2006-03-09 09:20 UTC]First time i try Console_Wizard, long time ago after proposal was opened (snif)! But i expected to use it now as a cli front end.
I run in trouble with PHP 4.4.2:
Remember you defined PHP required min 4.1.0 as dependency
Parse error: parse error, unexpected T_STRING in [...]\pear\Console\Wizar
d.php on line 554
Due to "instanceof" operator (PHP5 only)
There are others implements on lines 689, 987.