[PEPr] Comment on PEAR::PEAR_Size
| From: | David Coallier | Date: | Sun, 06 Jan 2008 20:12:48 +0000 |
| Subject: | [PEPr] Comment on PEAR::PEAR_Size | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-48874@lists.php.net to get a copy of this message | ||
David Coallier (http://pear.php.net/user/davidc) has commented on the proposal for PEAR::PEAR_Size.
Comment:
Hrm. Couldn't you wrap that up in a simple class ?
Things like getVersion would be much cleaner (maintainable) if you'd save
it in a const.
To be honest I find that to be a very dirty way of doing it. You could
simply make a static call passing the options to your methods that are
going to be deciding what to do.
Restructuring your code will also allow people to make frontends and use
the code as they want around their code.
So resume:
- Wrap all your functions into a class (Make it instantiable)
- your pearize command file should simply be passing the Console options
to the cli constructor or such
- By doing this you'll clean the whole bazongle that is at the bottom of
the file (procedural part with direct switch, etc)
- I would add a display method that you would invoke when you want to echo
some data that way, one could overload the display method to any type of
display (xml, html, text, etc) (IE: $obj->display("Total: 30kb");)
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=522
--
Sent by PEPr, the automatic proposal system at http://pear.php.net