From 59d6d4ab188f03b3bb2cd0bf81ca57d53de5e7fc Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sat, 19 Jul 2003 09:50:18 +0000 Subject: [PATCH] Move filter functionality to dedicated function --- ext/spl/examples/filter.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/spl/examples/filter.inc b/ext/spl/examples/filter.inc index 5aae419caf..be25d6b1aa 100755 --- a/ext/spl/examples/filter.inc +++ b/ext/spl/examples/filter.inc @@ -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; } -- 2.50.1