]> granicus.if.org Git - php/commitdiff
Move filter functionality to dedicated function
authorMarcus Boerger <helly@php.net>
Sat, 19 Jul 2003 09:50:18 +0000 (09:50 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 19 Jul 2003 09:50:18 +0000 (09:50 +0000)
ext/spl/examples/filter.inc

index 5aae419caf9f75ede89d19c79eace0c3ae220aeb..be25d6b1aa9940ad037f146146da48a3d16c42e2 100755 (executable)
@@ -40,6 +40,10 @@ class filter implements spl_forward
                unset($this->it);
        }
 
+       protected function accept($curr) {
+               return ereg($this->regex, $curr);
+       }
+
        /**
         * Fetch next element and store it.
         *
@@ -49,7 +53,7 @@ class filter implements spl_forward
                $this->curr = false;
                while ($this->it->has_more()) {
                        $curr = $this->it->current();
-                       if (ereg($this->regex, $curr)) {
+                       if ($this->accept($curr)) {
                                $this->curr = $curr;
                                return;
                        }