Re: [PHP-DEV] SplFileObject Countable

2011-03-15 Thread Nick Pope
Hi Sebastian, Since Etienne brought it up, would it not also make sense for you to implement countWords() and countBytes()? Also, unicode issues aside, it might still be nice to implement countChars(). And finally, so that it provides all most of the functionality of the GNU wc program,

Re: [PHP-DEV] SplFileObject Countable

2011-03-15 Thread Sebastian Marek
Hello Nick, Might be fun, I'll have a look at it. Is the stuff I have done so far any good? I've got only a little C experience, so any feedback is good! cheers On Tue, Mar 15, 2011 at 9:35 AM, Nick Pope p...@nickpope.me.uk wrote: Hi Sebastian, Since Etienne brought it up, would it not

Re: [PHP-DEV] SplFileObject Countable

2011-03-15 Thread Peter Cowburn
Hi all, On 15 March 2011 09:35, Nick Pope p...@nickpope.me.uk wrote: Hi Sebastian, Since Etienne brought it up, would it not also make sense for you to implement countWords() and countBytes()? For countBytes() how is that different from SplFileInfo's getSize() ? As for countWords() and the

Re: [PHP-DEV] SplFileObject Countable

2011-03-15 Thread Nick Pope
On 15/03/11 10:01, Peter Cowburn wrote: For countBytes() how is that different from SplFileInfo's getSize() ? As for countWords() and the others, I think this crosses the line (in my view) over what a File Object should provide. Hi Peter Sebastian, Bah. It isn't. Obviously that was going

Re: [PHP-DEV] SplFileObject Countable

2011-03-15 Thread Alexey Zakhlestin
On Tue, Mar 15, 2011 at 1:54 PM, Nick Pope p...@nickpope.me.uk wrote: Currently we have:    SplFileInfo  -- information/metadata about a file.         |         V   SplFileObject -- modify/access contents of a file. It could make sense to subclass this to provide methods for accessing

Re: [PHP-DEV] SplFileObject Countable

2011-03-14 Thread Sebastian Marek
Hello, That makes perfect sense. I have raised a feature request and have attached a patch containing both countLines() method implementation and phpt tests. thx On Sun, Mar 13, 2011 at 9:39 PM, Etienne Kneuss col...@php.net wrote: On Mar 11 23:22:04, Sebastian Marek wrote: Hi, I have

Re: [PHP-DEV] SplFileObject Countable

2011-03-13 Thread Etienne Kneuss
On Mar 11 23:22:04, Sebastian Marek wrote: Hi, I have recently used SplFileObject to work with files. I was lacking a bit of functionality in there regarding counting number of lines in a given file. Although I could just load contents of the file to an array and check it size, I thought it

[PHP-DEV] SplFileObject Countable

2011-03-11 Thread Sebastian Marek
Hi, I have recently used SplFileObject to work with files. I was lacking a bit of functionality in there regarding counting number of lines in a given file. Although I could just load contents of the file to an array and check it size, I thought it would be nice to have SplFileObject Countable.