mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
Use IteratorDecorator from core
As far as I can tell, EchoIteratorDecorator is functionally identical to IteratorDecorator from includes/libs/iterators/ in core, so why have a separate copy? (EchoIteratorDecorator does pass through the return value of next() or rewind(), if any, but there shouldn't be any per the Iterator interface.) Change-Id: Ic763ec19c15f67d9c9b42ebffb88c52b9056ed22
This commit is contained in:
parent
fcde0cc8a7
commit
3af6a04c69
|
@ -1106,7 +1106,6 @@
|
|||
"EchoHtmlDigestEmailFormatter": "includes/formatters/EchoHtmlDigestEmailFormatter.php",
|
||||
"EchoHtmlEmailFormatter": "includes/formatters/EchoHtmlEmailFormatter.php",
|
||||
"EchoIcon": "includes/formatters/EchoIcon.php",
|
||||
"EchoIteratorDecorator": "includes/iterator/IteratorDecorator.php",
|
||||
"EchoLocalCache": "includes/cache/LocalCache.php",
|
||||
"EchoMentionInSummaryPresentationModel": "includes/formatters/MentionInSummaryPresentationModel.php",
|
||||
"EchoMentionPresentationModel": "includes/formatters/MentionPresentationModel.php",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* Applies a callback to all values returned from the iterator
|
||||
*/
|
||||
class EchoCallbackIterator extends EchoIteratorDecorator {
|
||||
class EchoCallbackIterator extends IteratorDecorator {
|
||||
/** @var callable */
|
||||
protected $callable;
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Allows extending classes to decorate an Iterator with
|
||||
* reduced boilerplate.
|
||||
*/
|
||||
abstract class EchoIteratorDecorator implements Iterator {
|
||||
/** @var Iterator */
|
||||
protected $iterator;
|
||||
|
||||
public function __construct( Iterator $iterator ) {
|
||||
$this->iterator = $iterator;
|
||||
}
|
||||
|
||||
public function current() {
|
||||
return $this->iterator->current();
|
||||
}
|
||||
|
||||
public function key() {
|
||||
return $this->iterator->key();
|
||||
}
|
||||
|
||||
public function next() {
|
||||
return $this->iterator->next();
|
||||
}
|
||||
|
||||
public function rewind() {
|
||||
return $this->iterator->rewind();
|
||||
}
|
||||
|
||||
public function valid() {
|
||||
return $this->iterator->valid();
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
* Alternatively wraps a recursive iterator to prevent recursing deeper
|
||||
* than the wrapped iterator.
|
||||
*/
|
||||
class EchoNotRecursiveIterator extends EchoIteratorDecorator implements RecursiveIterator {
|
||||
class EchoNotRecursiveIterator extends IteratorDecorator implements RecursiveIterator {
|
||||
public function hasChildren() {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue