Re: API RFC

From: Date: Thu, 03 Jun 2004 03:11:23 +0000
Subject: Re: API RFC
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-29937@lists.php.net to get a copy of this message
- 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
I prefer methods that read input to preface with "from" like "fromFile" or "fromString" or "fromXml" and methods that create output to preface with "to" like "toString", "toArray" and implied string methods "toXml" "toHtml" "toSql" etc.
Good point about 'from' and 'to'. The rule could be if only one type of string is spected, use toString(). If more, toXml,to Sql....
- setParam - set - run process: run() - parse() - process() - save a File: save($sFile) - saveFile($sFile) - get a string: get() - very common
veto - "toString()" is better get() is too generic
But is the most common.
- print on screen: show() - again, very common.
I prefer again "printScreen" or "echoScreen" - it should describe exactly what it does. "printHtml" "printSwf"
Is a little redundant. All now that print() and echo() send the output to screen. In special cases, we could use the printHtml and similars... And thanks for your comments...ç
Greg
Claudio Bustos Navarrete Psicólogo de la Universidad de Concepción E-mail: clbustos@entelchile.net Www: http://www.apsique.com

« previous php.pear.dev (#29937) next »