1
0
mirror of https://github.com/danog/amp.git synced 2024-12-13 09:57:25 +01:00
amp/lib/Internal/PrivateIterator.php

32 lines
615 B
PHP
Raw Normal View History

<?php
namespace Amp\Internal;
use Amp\Iterator;
use Amp\Promise;
/**
* Wraps an Iterator instance that has public methods to emit, complete, and fail into an object that only allows
* access to the public API methods.
*/
2018-06-18 20:00:01 +02:00
class PrivateIterator implements Iterator
{
/** @var \Amp\Iterator */
private $iterator;
2018-06-18 20:00:01 +02:00
public function __construct(Iterator $iterator)
{
$this->iterator = $iterator;
}
2018-06-18 20:00:01 +02:00
public function advance(): Promise
{
return $this->iterator->advance();
}
2018-06-18 20:00:01 +02:00
public function getCurrent()
{
return $this->iterator->getCurrent();
}
}