API RFC
| From: | Claudio Bustos | Date: | Thu, 03 Jun 2004 02:47:00 +0000 |
| Subject: | API RFC | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-29935@lists.php.net to get a copy of this message | ||
Pear-devs:
Reading the post about Savant, I think that would be a good idea create an API reference for new files. In PHP 5, this will be implemented with interfaces.
For example, many classes handles input from files and arrays and returns string or save files. With a very fast search on XML, I found:
- get input from file: getTreeFromFile(XML_Tree),setInputFile(XML_Parser), XML_image2svg(XML_image2svg),runFromFile(xml_fo2pdf)
- get input from string: getTreeFromFile(XML_Tree),setInputString(XML_Parser),runFromString(xml_fo2pdf)
- return string:get(XML_Tree,XML_image2svg), transform (-with implicit parsing -XML_Transformer), toString(XML_NITF), returnPDF(xml_fo2pdf)
- print to screen: dump (XML_Tree),show(XML_image2svg),printPDF(xml_fo2pdf)
Many ways to do the same thing. Is a pain read a lot of documentation to:
- create a instance of the object
- set params
- set the input file or string
- start the process
- save a file or get a string
If you want it, I can search in the packages and get a list of commons names for method that do the same thing. Next, we could create a RFC for newcomers with a set of interfaces and the old ones could create wrappers for this standards methods. BTW, for the previous method we could use
- create a instance: constructor, singleton() or factory() - very commons
- set parameters: setParameter($param,$value) or similar
- set input and output file: setInputFile - setOutputFile
- set input string: setInputString
- setParam - set
- run process: run() - parse() - process()
- save a File: save($sFile) - saveFile($sFile)
- get a string: get() - very common
- print on screen: show() - again, very common.
See ya!
Claudio Bustos Navarrete
Psicólogo de la Universidad de Concepción
E-mail: clbustos@entelchile.net
Www: http://www.apsique.com