ACC SHELL

Path : /srv/www/vhosts/centrumlb/3rdparty/Nette/ComponentModel/
File Upload :
Current File : /srv/www/vhosts/centrumlb/3rdparty/Nette/ComponentModel/RecursiveComponentIterator.php

<?php

/**
 * This file is part of the Nette Framework (http://nette.org)
 * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 * @package Nette\ComponentModel
 */



/**
 * Recursive component iterator. See NComponentContainer::getComponents().
 *
 * @author     David Grudl
 * @internal
 * @package Nette\ComponentModel
 */
class NRecursiveComponentIterator extends RecursiveArrayIterator implements Countable
{

	/**
	 * Has the current element has children?
	 * @return bool
	 */
	public function hasChildren()
	{
		return $this->current() instanceof IComponentContainer;
	}


	/**
	 * The sub-iterator for the current element.
	 * @return RecursiveIterator
	 */
	public function getChildren()
	{
		return $this->current()->getComponents();
	}


	/**
	 * Returns the count of elements.
	 * @return int
	 */
	public function count()
	{
		return iterator_count($this);
	}

}

ACC SHELL 2018