[PEPr] Comment on File Formats::Bittorrent
| From: | PEPr | Date: | Fri, 25 Jun 2004 17:36:16 +0000 |
| Subject: | [PEPr] Comment on File Formats::Bittorrent | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-31191@lists.php.net to get a copy of this message | ||
Ian Eure (http://pear.php.net/user/ieure) has commented on the proposal for File
Formats::Bittorrent.
Comment:
Looks nice, but I'd like to see things cleaned up somewhat.
* Wrong class name in info().
* $fileContents is only used once and never unset. $decoded =
$this->bdecode(file_get_contents($file)); is better, imo. (lines 144/5)
* Please use basename() to get the filename portion instead of strrpos(). (Line 146)
* getInfo() seems unnecessary, as the properties can be accessed directly.
* I'd like to see the BEn/Decode functions split into a seperate class.
* bdecode_rec() should use switch($t) { ... } instead of that big if/else. Same for bencode_rec().
* Better documentation of arguments & return values. I know that decode_int() returns an array,
but what are in the elements? What's the point of the 'l' in these arrays, why not
return the value directly?
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=100
--
Sent by PEPr, the automatic proposal system at http://pear.php.net