mageekguy\atoum\php\tokenizer\iterator::append PHP Метод

append() публичный Метод

public append ( mageekguy\atoum\php\tokenizer\iterator\value $value )
$value mageekguy\atoum\php\tokenizer\iterator\value
    public function append(value $value)
    {
        if ($value->parent !== null) {
            throw new exceptions\runtime('Unable to append value because it has already a parent');
        }
        $value->parent = $this;
        $this->values[] = $value;
        if ($this->key === null) {
            $this->key = 0;
        }
        $size = sizeof($value);
        if ($size > 0) {
            $value->rewind();
            $this->size += $size;
            $parent = $this->parent;
            while ($parent !== null) {
                $parent->size += $size;
                $parent = $parent->parent;
            }
        }
        return $this;
    }

Usage Example

Пример #1
0
 public function testFindTag()
 {
     $iterator = new tokenizer\iterator();
     $this->assert->variable($iterator->key())->isNull()->variable($iterator->findTag(uniqid()))->isNull()->variable($iterator->key())->isNull();
     $iterator->append(new tokenizer\token($token = uniqid()));
     $this->assert->integer($iterator->key())->isZero()->variable($iterator->findTag(uniqid()))->isNull()->variable($iterator->key())->isNull()->integer($iterator->findTag($token))->isZero()->integer($iterator->key())->isZero();
 }
All Usage Examples Of mageekguy\atoum\php\tokenizer\iterator::append