cvs: presentations /slides/php5intro spl.php

From: Date: Tue, 25 Mar 2003 04:27:42 +0000
Subject: cvs: presentations /slides/php5intro spl.php
Groups: php.pres 
Request: Send a blank email to pres+get-623@lists.php.net to get a copy of this message
sterling Mon Mar 24 23:27:42 2003 EDT Modified files: /presentations/slides/php5intro spl.php Log: indentation Index: presentations/slides/php5intro/spl.php diff -u presentations/slides/php5intro/spl.php:1.2 presentations/slides/php5intro/spl.php:1.3 --- presentations/slides/php5intro/spl.php:1.2 Sun Mar 23 16:56:19 2003 +++ presentations/slides/php5intro/spl.php Mon Mar 24 23:27:42 2003 @@ -1,10 +1,15 @@ <?php -class dba_reader implements spl::iterator { - +class dba_reader + implements spl::iterator { public $db = NULL; - function __construct($file, $handler) { - $this->db = dba_open($file, 'r', $handler); + function __construct($file, $handler) + { + $this->db = dba_open( + $file, + 'r', + $handler + ); } function new_iterator() { @@ -12,7 +17,9 @@ } } -class dba_iter implements spl::sequence_assoc { +class dba_iter + implements spl::sequence_assoc +{ private $obj; private $key = NULL; private $val = NULL; @@ -22,9 +29,11 @@ } function reset() { - if ($this->obj->db) { - $this->key = dba_firstkey($this->obj->db); - } + if (!$this->obj->db) { + return; + } + $this->key = + dba_firstkey($this->obj->db); } function elem() { @@ -32,12 +41,17 @@ } function next() { - $this->key = dba_nextkey($this->obj->db); + $this->key = + dba_nextkey($this->obj->db); } function more() { - if ($this->obj->db && $this->key !== false) { - $this->val = dba_fetch($this->key, $this->obj->db); + if ($this->obj->db && + $this->key !== false) { + $this->val = dba_fetch( + $this->key, + $this->obj->db + ); return true; } else { return false;

« previous php.pres (#623) next »