<commit_before><?php
/**
 * Vision PHP-Framework
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2012-2014 <NAME>
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 */
namespace Vision\DataStructures\Tree;

/**
 * @author <NAME>
 */
class NodeIterator implements \RecursiveIterator
{
    /** @type array $nodes */
    private $nodes;

    /** @type int $position */
    private $position;

    /**
     * @param NodeInterface $node
     */
    public function __construct(NodeInterface $node)
    {
        $this->nodes = $node->getChildren();
    }

    public function hasChildren()
    {
        return $this->current()->hasChildren();
    }

    public function getChildren()
    {
        return new self($this->current());
    }

    public function current()
    {
        return $this->nodes[$this->position];
    }

    public function key()
    {
        return $this->position;
    }

    public function next()<commit_msg>Fix: position may not be null<commit_after><?php
/**
 * Vision PHP-Framework
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2012-2014 <NAME>
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 */
namespace Vision\DataStructures\Tree;

/**
 * @author <NAME>
 */
class NodeIterator implements \RecursiveIterator
{
    /** @type array $nodes */
    private $nodes;

    /** @type int $position */
    private $position = 0;

    /**
     * @param NodeInterface $node
     */
    public function __construct(NodeInterface $node)
    {
        $this->nodes = $node->getChildren();
    }

    public function hasChildren()
    {
        return $this->current()->hasChildren();
    }

    public function getChildren()
    {
        return new self($this->current());
    }

    public function current()
    {
        return $this->nodes[$this->position];
    }

    public function key()
    {
        return $this->position;
    }

    public function next()
{'fraction_non_alphanumeric': 0.14822546972860126, 'fraction_numerical': 0.008872651356993737, 'mean_word_length': 2.472826086956522, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3947029', 'n_tokens_mistral': 578, 'n_tokens_neox': 550, 'n_words': 131}