class Iterator
Same name in this branch
- 11.1.x vendor/phpunit/php-file-iterator/src/Iterator.php \SebastianBergmann\FileIterator\Iterator
@internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
Hierarchy
- class \SebastianBergmann\CodeCoverage\Node\Iterator implements \RecursiveIterator
Expanded class hierarchy of Iterator
11 string references to 'Iterator'
- Container::resolveServicesAndParameters in core/
lib/ Drupal/ Component/ DependencyInjection/ Container.php - Resolves arguments that represent services or variables to the real values.
- DebugClassLoader::setReturnType in vendor/
symfony/ error-handler/ DebugClassLoader.php - Migration::findMigrationDependencies in core/
modules/ migrate/ src/ Plugin/ Migration.php - Find migration dependencies from migration_lookup and sub_process plugins.
- OptimizedPhpArrayDumper::getIterator in core/
lib/ Drupal/ Component/ DependencyInjection/ Dumper/ OptimizedPhpArrayDumper.php - Gets a service iterator in a suitable PHP array format.
- PhpArrayContainer::resolveServicesAndParameters in core/
lib/ Drupal/ Component/ DependencyInjection/ PhpArrayContainer.php - Resolves arguments that represent services or variables to the real values.
File
-
vendor/
phpunit/ php-code-coverage/ src/ Node/ Iterator.php, line 18
Namespace
SebastianBergmann\CodeCoverage\NodeView source
final class Iterator implements RecursiveIterator {
private int $position;
/**
* @var list<AbstractNode>
*/
private readonly array $nodes;
public function __construct(Directory $node) {
$this->nodes = $node->children();
}
/**
* Rewinds the Iterator to the first element.
*/
public function rewind() : void {
$this->position = 0;
}
/**
* Checks if there is a current element after calls to rewind() or next().
*/
public function valid() : bool {
return $this->position < count($this->nodes);
}
/**
* Returns the key of the current element.
*/
public function key() : int {
return $this->position;
}
/**
* Returns the current element.
*/
public function current() : ?AbstractNode {
return $this->valid() ? $this->nodes[$this->position] : null;
}
/**
* Moves forward to next element.
*/
public function next() : void {
$this->position++;
}
/**
* Returns the sub iterator for the current element.
*/
public function getChildren() : self {
return new self($this->nodes[$this->position]);
}
/**
* Checks whether the current element has children.
*/
public function hasChildren() : bool {
return $this->nodes[$this->position] instanceof Directory;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
Iterator::$nodes | private | property | |
Iterator::$position | private | property | |
Iterator::current | public | function | Returns the current element. |
Iterator::getChildren | public | function | Returns the sub iterator for the current element. |
Iterator::hasChildren | public | function | Checks whether the current element has children. |
Iterator::key | public | function | Returns the key of the current element. |
Iterator::next | public | function | Moves forward to next element. |
Iterator::rewind | public | function | Rewinds the Iterator to the first element. |
Iterator::valid | public | function | Checks if there is a current element after calls to rewind() or next(). |
Iterator::__construct | public | function |