summaryrefslogtreecommitdiff
path: root/ext/spl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl')
-rw-r--r--ext/spl/examples/cachingiterator.inc6
-rwxr-xr-xext/spl/examples/dba_reader.inc2
-rwxr-xr-xext/spl/examples/filteriterator.inc6
-rwxr-xr-xext/spl/examples/key_filter.inc4
-rwxr-xr-xext/spl/examples/limititerator.inc6
-rwxr-xr-xext/spl/examples/recursiveiteratoriterator.inc10
-rwxr-xr-xext/spl/examples/searchiterator.inc4
-rwxr-xr-xext/spl/examples/seekableiterator.inc2
-rwxr-xr-xext/spl/spl.php22
-rwxr-xr-xext/spl/spl_array.c8
-rwxr-xr-xext/spl/spl_directory.c6
-rwxr-xr-xext/spl/spl_iterators.c18
-rwxr-xr-xext/spl/spl_sxe.c4
-rwxr-xr-xext/spl/tests/array_iterator.phpt4
-rwxr-xr-xext/spl/tests/limititerator.phpt24
-rwxr-xr-xext/spl/tests/sxe_003.phpt2
16 files changed, 64 insertions, 64 deletions
diff --git a/ext/spl/examples/cachingiterator.inc b/ext/spl/examples/cachingiterator.inc
index d828b88e7b..6a20652341 100644
--- a/ext/spl/examples/cachingiterator.inc
+++ b/ext/spl/examples/cachingiterator.inc
@@ -26,7 +26,7 @@ class CachingIterator
function next()
{
- if ($this->more = $this->it->hasMore()) {
+ if ($this->more = $this->it->valid()) {
$this->current = $this->it->current();
$this->key = $this->it->key();
if ($this->flags & CIT_CALL_TOSTRING) {
@@ -44,14 +44,14 @@ class CachingIterator
$this->it->next();
}
- function hasMore()
+ function valid()
{
return $this->more;
}
function hasNext()
{
- return $this->it->hasMore();
+ return $this->it->valid();
}
function current()
diff --git a/ext/spl/examples/dba_reader.inc b/ext/spl/examples/dba_reader.inc
index d21db45613..fa8fd3d854 100755
--- a/ext/spl/examples/dba_reader.inc
+++ b/ext/spl/examples/dba_reader.inc
@@ -64,7 +64,7 @@ class DbaReader implements Iterator
/**
* @return Whether more elements are available.
*/
- function hasMore() {
+ function valid() {
if ($this->db && $this->key !== false) {
return true;
} else {
diff --git a/ext/spl/examples/filteriterator.inc b/ext/spl/examples/filteriterator.inc
index ac8236aa36..7040c4bef9 100755
--- a/ext/spl/examples/filteriterator.inc
+++ b/ext/spl/examples/filteriterator.inc
@@ -47,7 +47,7 @@ abstract class FilterIterator implements Iterator
* @return void
*/
protected function fetch() {
- while ($this->it->hasMore()) {
+ while ($this->it->valid()) {
if ($this->accept()) {
return;
}
@@ -68,8 +68,8 @@ abstract class FilterIterator implements Iterator
/**
* @return Whether more elements are available
*/
- function hasMore() {
- return $this->it->hasMore();
+ function valid() {
+ return $this->it->valid();
}
/**
diff --git a/ext/spl/examples/key_filter.inc b/ext/spl/examples/key_filter.inc
index 6dfd19c85b..2acfc69a34 100755
--- a/ext/spl/examples/key_filter.inc
+++ b/ext/spl/examples/key_filter.inc
@@ -53,7 +53,7 @@ class KeyFilter implements Iterator
protected function fetch() {
$this->key = false;
$this->curr = false;
- while ($this->it->hasMore()) {
+ while ($this->it->valid()) {
$key = $this->it->key();
if (ereg($this->regex, $key)) {
$this->key = $key;
@@ -77,7 +77,7 @@ class KeyFilter implements Iterator
/**
* @return Whether more elements are available
*/
- function hasMore() {
+ function valid() {
return $this->key !== false;
}
diff --git a/ext/spl/examples/limititerator.inc b/ext/spl/examples/limititerator.inc
index e471f5d0e4..9a87f6874f 100755
--- a/ext/spl/examples/limititerator.inc
+++ b/ext/spl/examples/limititerator.inc
@@ -33,7 +33,7 @@ class LimitIterator implements Iterator
$this->it->seek($position);
$this->pos = $position;
} else {
- while($this->pos < $position && $this->it->hasMore()) {
+ while($this->pos < $position && $this->it->valid()) {
$this->next();
}
}
@@ -46,9 +46,9 @@ class LimitIterator implements Iterator
$this->seek($this->offset);
}
- function hasMore() {
+ function valid() {
return ($this->count == -1 || $this->pos < $this->offset + $this->count)
- && $this->it->hasMore();
+ && $this->it->valid();
}
function key() {
diff --git a/ext/spl/examples/recursiveiteratoriterator.inc b/ext/spl/examples/recursiveiteratoriterator.inc
index b48efb2b3b..05e31df464 100755
--- a/ext/spl/examples/recursiveiteratoriterator.inc
+++ b/ext/spl/examples/recursiveiteratoriterator.inc
@@ -26,12 +26,12 @@ class RecursiveIteratorIterator implements Iterator
$this->ait[0]->recursed = false;
}
- function hasMore()
+ function valid()
{
$count = $this->count;
while ($count) {
$it = $this->ait[$count];
- if ($it->hasMore()) {
+ if ($it->valid()) {
return true;
}
$count--;
@@ -55,13 +55,13 @@ class RecursiveIteratorIterator implements Iterator
{
while ($this->count) {
$it = $this->ait[$this->count];
- if ($it->hasMore()) {
+ if ($it->valid()) {
if (!$it->recursed && $it->hasChildren()) {
$it->recursed = true;
$sub = $it->getChildren();
$sub->recursed = false;
$sub->rewind();
- if ($sub->hasMore()) {
+ if ($sub->valid()) {
$this->ait[++$this->count] = $sub;
if (!$sub instanceof RecursiveIterator) {
throw new Exception(get_class($sub).'::getChildren() must return an object that implements RecursiveIterator');
@@ -72,7 +72,7 @@ class RecursiveIteratorIterator implements Iterator
}
$it->next();
$it->recursed = false;
- if ($it->hasMore()) {
+ if ($it->valid()) {
return;
}
$it->recursed = false;
diff --git a/ext/spl/examples/searchiterator.inc b/ext/spl/examples/searchiterator.inc
index 1ce5a2eebd..a9ba9df171 100755
--- a/ext/spl/examples/searchiterator.inc
+++ b/ext/spl/examples/searchiterator.inc
@@ -9,8 +9,8 @@ abstract class SearchIterator extends FilterIterator
$this->done = false;
}
- function hasMore() {
- return !$this->done && parent::hasMore();
+ function valid() {
+ return !$this->done && parent::valid();
}
function next() {
diff --git a/ext/spl/examples/seekableiterator.inc b/ext/spl/examples/seekableiterator.inc
index 7e47009260..3012155771 100755
--- a/ext/spl/examples/seekableiterator.inc
+++ b/ext/spl/examples/seekableiterator.inc
@@ -19,7 +19,7 @@ interface SeekableIterator implements Iterator
function seek($index);
/* $this->rewind();
$position = 0;
- while($position < $index && $this->hasMore()) {
+ while($position < $index && $this->valid()) {
$this->next();
$position++;
}
diff --git a/ext/spl/spl.php b/ext/spl/spl.php
index 6cc0ed6b5f..84b7e4ebe1 100755
--- a/ext/spl/spl.php
+++ b/ext/spl/spl.php
@@ -54,7 +54,7 @@ interface Iterator implements Traversable
/** Check if there is a current element after calls to rewind() or next().
*/
- function hasMore();
+ function valid();
}
/** Interface for recursive traversal to be used with
@@ -156,9 +156,9 @@ class ArrayIterator implements Iterator
*/
function next();
- /** \copydoc Iterator::hasMore
+ /** \copydoc Iterator::valid
*/
- function hasMore();
+ function valid();
}
/** Iterator that wrapps around another iterator and only returns selected
@@ -193,9 +193,9 @@ abstract class FilterIterator implements Iterator
*/
function next();
- /** \copydoc Iterator::hasMore
+ /** \copydoc Iterator::valid
*/
- function hasMore();
+ function valid();
}
/** A recursive iterator that only returns elements that themselves can be
@@ -233,9 +233,9 @@ class ParentIterator extends FilterIterator implements RecursiveIterator
*/
function next();
- /** \copydoc Iterator::hasMore
+ /** \copydoc Iterator::valid
*/
- function hasMore();
+ function valid();
}
/** \brief Directory iterator
@@ -260,9 +260,9 @@ class DirectoryIterator implements Iterator
*/
function next();
- /** \copydoc Iterator::hasMore
+ /** \copydoc Iterator::valid
*/
- function hasMore();
+ function valid();
/** \return The opened path.
*/
@@ -301,9 +301,9 @@ class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveI
*/
function next();
- /** \copydoc Iterator::hasMore
+ /** \copydoc Iterator::valid
*/
- function hasMore();
+ function valid();
/** \return whether the current is a directory (not '.' or '..').
*/
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index bd1e12ce9e..679b6e2724 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -39,7 +39,7 @@ SPL_METHOD(Array, rewind);
SPL_METHOD(Array, current);
SPL_METHOD(Array, key);
SPL_METHOD(Array, next);
-SPL_METHOD(Array, hasMore);
+SPL_METHOD(Array, valid);
static
ZEND_BEGIN_ARG_INFO(arginfo_array___construct, 0)
@@ -58,7 +58,7 @@ static zend_function_entry spl_funcs_ArrayIterator[] = {
SPL_ME(Array, current, NULL, ZEND_ACC_PUBLIC)
SPL_ME(Array, key, NULL, ZEND_ACC_PUBLIC)
SPL_ME(Array, next, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(Array, hasMore, NULL, ZEND_ACC_PUBLIC)
+ SPL_ME(Array, valid, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
@@ -485,9 +485,9 @@ SPL_METHOD(Array, next)
}
/* }}} */
-/* {{{ proto bool ArrayIterator::hasMore()
+/* {{{ proto bool ArrayIterator::valid()
Check whether array contains more entries */
-SPL_METHOD(Array, hasMore)
+SPL_METHOD(Array, valid)
{
zval *object = getThis();
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index e8431e8b4e..19aa9354dc 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -251,9 +251,9 @@ SPL_METHOD(DirectoryIterator, next)
}
/* }}} */
-/* {{{ proto string DirectoryIterator::hasMore()
+/* {{{ proto string DirectoryIterator::valid()
Check whether dir contains more entries */
-SPL_METHOD(DirectoryIterator, hasMore)
+SPL_METHOD(DirectoryIterator, valid)
{
zval *object = getThis();
spl_ce_dir_object *intern = (spl_ce_dir_object*)zend_object_store_get_object(object TSRMLS_CC);
@@ -734,7 +734,7 @@ ZEND_END_ARG_INFO();
static zend_function_entry spl_ce_dir_class_functions[] = {
SPL_ME(DirectoryIterator, __construct, arginfo_dir___construct, ZEND_ACC_PUBLIC)
SPL_ME(DirectoryIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(DirectoryIterator, hasMore, NULL, ZEND_ACC_PUBLIC)
+ SPL_ME(DirectoryIterator, valid, NULL, ZEND_ACC_PUBLIC)
SPL_ME(DirectoryIterator, key, NULL, ZEND_ACC_PUBLIC)
SPL_ME(DirectoryIterator, current, NULL, ZEND_ACC_PUBLIC)
SPL_ME(DirectoryIterator, next, NULL, ZEND_ACC_PUBLIC)
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index a9e1d9766a..e5fd0d3547 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -53,7 +53,7 @@ function_entry spl_funcs_RecursiveIterator[] = {
SPL_METHOD(RecursiveIteratorIterator, __construct);
SPL_METHOD(RecursiveIteratorIterator, rewind);
-SPL_METHOD(RecursiveIteratorIterator, hasMore);
+SPL_METHOD(RecursiveIteratorIterator, valid);
SPL_METHOD(RecursiveIteratorIterator, key);
SPL_METHOD(RecursiveIteratorIterator, current);
SPL_METHOD(RecursiveIteratorIterator, next);
@@ -74,7 +74,7 @@ ZEND_END_ARG_INFO();
static zend_function_entry spl_funcs_RecursiveIteratorIterator[] = {
SPL_ME(RecursiveIteratorIterator, __construct, arginfo_recursive_it___construct, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveIteratorIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(RecursiveIteratorIterator, hasMore, NULL, ZEND_ACC_PUBLIC)
+ SPL_ME(RecursiveIteratorIterator, valid, NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveIteratorIterator, key, NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveIteratorIterator, current, NULL, ZEND_ACC_PUBLIC)
SPL_ME(RecursiveIteratorIterator, next, NULL, ZEND_ACC_PUBLIC)
@@ -348,7 +348,7 @@ SPL_METHOD(RecursiveIteratorIterator, rewind)
spl_recursive_it_rewind_ex(object TSRMLS_CC);
}
-SPL_METHOD(RecursiveIteratorIterator, hasMore)
+SPL_METHOD(RecursiveIteratorIterator, valid)
{
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
@@ -670,7 +670,7 @@ SPL_METHOD(dual_it, rewind)
spl_dual_it_fetch(intern, 1 TSRMLS_CC);
}
-SPL_METHOD(dual_it, hasMore)
+SPL_METHOD(dual_it, valid)
{
spl_dual_it_object *intern;
@@ -842,7 +842,7 @@ ZEND_END_ARG_INFO();
static zend_function_entry spl_funcs_FilterIterator[] = {
SPL_ME(dual_it, __construct, arginfo_filter_it___construct, ZEND_ACC_PUBLIC)
SPL_ME(FilterIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(dual_it, hasMore, NULL, ZEND_ACC_PUBLIC)
+ SPL_ME(dual_it, valid, NULL, ZEND_ACC_PUBLIC)
SPL_ME(dual_it, key, NULL, ZEND_ACC_PUBLIC)
SPL_ME(dual_it, current, NULL, ZEND_ACC_PUBLIC)
SPL_ME(FilterIterator, next, NULL, ZEND_ACC_PUBLIC)
@@ -926,7 +926,7 @@ SPL_METHOD(LimitIterator, rewind)
spl_limit_it_seek(intern, intern->u.limit.offset TSRMLS_CC);
}
-SPL_METHOD(LimitIterator, hasMore)
+SPL_METHOD(LimitIterator, valid)
{
spl_dual_it_object *intern;
@@ -994,7 +994,7 @@ ZEND_END_ARG_INFO();
static zend_function_entry spl_funcs_LimitIterator[] = {
SPL_ME(LimitIterator, __construct, arginfo_limit_it___construct, ZEND_ACC_PUBLIC)
SPL_ME(LimitIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(LimitIterator, hasMore, NULL, ZEND_ACC_PUBLIC)
+ SPL_ME(LimitIterator, valid, NULL, ZEND_ACC_PUBLIC)
SPL_ME(dual_it, key, NULL, ZEND_ACC_PUBLIC)
SPL_ME(dual_it, current, NULL, ZEND_ACC_PUBLIC)
SPL_ME(LimitIterator, next, NULL, ZEND_ACC_PUBLIC)
@@ -1075,7 +1075,7 @@ SPL_METHOD(CachingIterator, rewind)
spl_caching_it_rewind(intern TSRMLS_CC);
}
-SPL_METHOD(CachingIterator, hasMore)
+SPL_METHOD(CachingIterator, valid)
{
spl_dual_it_object *intern;
@@ -1127,7 +1127,7 @@ ZEND_END_ARG_INFO();
static zend_function_entry spl_funcs_CachingIterator[] = {
SPL_ME(CachingIterator, __construct, arginfo_caching_it___construct, ZEND_ACC_PUBLIC)
SPL_ME(CachingIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(CachingIterator, hasMore, NULL, ZEND_ACC_PUBLIC)
+ SPL_ME(CachingIterator, valid, NULL, ZEND_ACC_PUBLIC)
SPL_ME(dual_it, key, NULL, ZEND_ACC_PUBLIC)
SPL_ME(dual_it, current, NULL, ZEND_ACC_PUBLIC)
SPL_ME(CachingIterator, next, NULL, ZEND_ACC_PUBLIC)
diff --git a/ext/spl/spl_sxe.c b/ext/spl/spl_sxe.c
index b433864b1b..325a5770b5 100755
--- a/ext/spl/spl_sxe.c
+++ b/ext/spl/spl_sxe.c
@@ -47,7 +47,7 @@ SPL_METHOD(SimpleXMLIterator, rewind) /* {{{ */
}
/* }}} */
-SPL_METHOD(SimpleXMLIterator, hasMore) /* {{{ */
+SPL_METHOD(SimpleXMLIterator, valid) /* {{{ */
{
php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
@@ -134,7 +134,7 @@ SPL_METHOD(SimpleXMLIterator, getChildren)
static zend_function_entry spl_funcs_SimpleXMLIterator[] = {
SPL_ME(SimpleXMLIterator, rewind, NULL, ZEND_ACC_PUBLIC)
- SPL_ME(SimpleXMLIterator, hasMore, NULL, ZEND_ACC_PUBLIC)
+ SPL_ME(SimpleXMLIterator, valid, NULL, ZEND_ACC_PUBLIC)
SPL_ME(SimpleXMLIterator, current, NULL, ZEND_ACC_PUBLIC)
SPL_ME(SimpleXMLIterator, key, NULL, ZEND_ACC_PUBLIC)
SPL_ME(SimpleXMLIterator, next, NULL, ZEND_ACC_PUBLIC)
diff --git a/ext/spl/tests/array_iterator.phpt b/ext/spl/tests/array_iterator.phpt
index ef5a79819d..3e6c1e0f10 100755
--- a/ext/spl/tests/array_iterator.phpt
+++ b/ext/spl/tests/array_iterator.phpt
@@ -130,9 +130,9 @@ Notice: ArrayIterator::next(): Array was modified outside object and internal po
Notice: ArrayIterator::next(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
-Notice: ArrayIterator::hasMore(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
+Notice: ArrayIterator::valid(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
Notice: ArrayIterator::next(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
-Notice: ArrayIterator::hasMore(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
+Notice: ArrayIterator::valid(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d
Done
diff --git a/ext/spl/tests/limititerator.phpt b/ext/spl/tests/limititerator.phpt
index 673a529cde..37ba0cbf1b 100755
--- a/ext/spl/tests/limititerator.phpt
+++ b/ext/spl/tests/limititerator.phpt
@@ -22,7 +22,7 @@ class NumericArrayIterator implements Iterator
$this->i = 0;
}
- public function hasMore()
+ public function valid()
{
$ret = $this->i < count($this->a);
echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n";
@@ -87,20 +87,20 @@ for($i = 1; $i < 4; $i++)
--EXPECT--
NumericArrayIterator::__construct
NumericArrayIterator::rewind
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::next
-NumericArrayIterator::hasMore(true)
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
2
NumericArrayIterator::next
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
3
NumericArrayIterator::next
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
4
@@ -109,17 +109,17 @@ NumericArrayIterator::next
NumericArrayIterator::__construct
NumericArrayIterator::rewind
SeekableNumericArrayIterator::seek(1)
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
2
NumericArrayIterator::next
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
3
NumericArrayIterator::next
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
4
@@ -127,17 +127,17 @@ NumericArrayIterator::next
===SEEKING===
NumericArrayIterator::__construct
SeekableNumericArrayIterator::seek(1)
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
2
SeekableNumericArrayIterator::seek(2)
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
3
SeekableNumericArrayIterator::seek(3)
-NumericArrayIterator::hasMore(true)
+NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
4
diff --git a/ext/spl/tests/sxe_003.phpt b/ext/spl/tests/sxe_003.phpt
index d247896887..aab7de7202 100755
--- a/ext/spl/tests/sxe_003.phpt
+++ b/ext/spl/tests/sxe_003.phpt
@@ -45,7 +45,7 @@ foreach($sxe->getChildren() as $name => $data) {
echo "===RESET===\n";
-for ($sxe->rewind(); $sxe->hasMore(); $sxe->next()) {
+for ($sxe->rewind(); $sxe->valid(); $sxe->next()) {
var_dump($sxe->hasChildren());
var_dump(trim($sxe->key()));
var_dump(trim($sxe->current()));