[PEPr] Comment on Web Services::Services_JSON
| From: | Philippe Jausions | Date: | Thu, 11 Aug 2005 23:04:47 +0000 |
| Subject: | [PEPr] Comment on Web Services::Services_JSON | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-39332@lists.php.net to get a copy of this message | ||
Philippe Jausions (http://pear.php.net/user/jausions) has commented on the proposal for Web
Services::Services_JSON.
Comment:
In my tests sprintf('"%s"', $str) is much slower than '"' . $str
. '"'
In reduce_string() use an array of patterns instead of 3 independent calls
to preg_replace. and simply "return trim($str);" instead of assigning +
return.
Otherwise some CS problems: put spaces before the opening parenthesis
after "if" "switch" "for" and the like.
Doing ++$loop instead of $loop++ in "for" loops is a little bit faster.
In decode(), use preg_match('/^("|\').+$/s') instead of 2 preg_match().
And farther down fix buggy regex to preg_match('/^\(.*\)$/s')
The ObjectFromJSON class name is not PEAR CS compliant. Any objection to
use stdClass instead, although it may be use full to have a specific class
for JSON-created objects? You could accept a class name to be used too.
On the same topic, Services_JSON is illsuited IMO. Maybe PHP_JSON? Anyway,
whatever name it will be, the constants and class names will need to be
corrected.
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=198
--
Sent by PEPr, the automatic proposal system at http://pear.php.net