Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51672 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28061 invoked from network); 11 Mar 2011 23:22:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2011 23:22:09 -0000 Authentication-Results: pb1.pair.com header.from=proofek@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=proofek@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: proofek@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:61920] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9A/F3-04075-F9EAA7D4 for ; Fri, 11 Mar 2011 18:22:08 -0500 Received: by qwi4 with SMTP id 4so156315qwi.29 for ; Fri, 11 Mar 2011 15:22:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=nzGkow0S9K7ve8DxhvdCrYfGskoj+Bc0S5nJe3oNw0I=; b=A3tZca0N5YEyrXzAYTCa3+DgTBf43O96dnsGa8f15/wSWrW0HjkZwSsg3elfp9Oczq RjJq7wXzoXrXm6QOLTDWgvUTAZ/JS6Vp75ruzve0Mq2enILIOsXAMViCjlLxa6O8jYEX fbKBqartA19WEQU6UDA6UNNZsv7KdDBBUjRzs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=PCIyyHW2QKcB4x/Q1mR8i/WwIm9MXW3FtLgf1C+KkCMmNEbuICcwuh/W0Nyd0sqfP6 PBXxjyzMYeCYb1ivsghe2js7EcBxYSOEc5eUDTEsPP4xSL/wFZhnDD3L2cYCnwgc2+mZ /+XIxpvfZW8OU2ZibPGhGtENJlFDKaa3pw4PQ= MIME-Version: 1.0 Received: by 10.229.35.129 with SMTP id p1mr4977359qcd.139.1299885724657; Fri, 11 Mar 2011 15:22:04 -0800 (PST) Received: by 10.229.192.73 with HTTP; Fri, 11 Mar 2011 15:22:04 -0800 (PST) Date: Fri, 11 Mar 2011 23:22:04 +0000 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016367b7172dde8e4049e3d3a21 Subject: SplFileObject Countable From: proofek@gmail.com (Sebastian Marek) --0016367b7172dde8e4049e3d3a21 Content-Type: text/plain; charset=UTF-8 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. Here is an example implementation I made tonight that seems to work well - https://gist.github.com/866767 . Is it something you think would be worth adding to the existing SplFileObject? Is the implementation any good? I reused some of the existing logic to avoid breaking 'spl_filesystem_object' internal integrity, but maybe it would make sense to make it work with the stream itself. If it's fine I can write some unit tests to cover this and then submit a complete patch. Regards -- Sebastian Marek proofek@gmail.com Follow me online at: Blog: http://criticallog.thornet.net/ Twitter: http://twitter.com/proofek Linkedin: http://uk.linkedin.com/in/sebastianmarek Ohloh: http://www.ohloh.net/accounts/proofek --0016367b7172dde8e4049e3d3a21--