Initial commit

This commit is contained in:
2024-10-01 18:46:03 +02:00
commit e2868cd7bf
16 changed files with 1036 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace NoccyLabs\JEdit\Tree;
class ArrayNode extends Node implements CollapsibleNode
{
use CollapsibleNodeTrait;
public function __construct(public array $items)
{
}
public function append(Node $value)
{
$this->items[] = $value;
}
public function removeIndex(int $index)
{
unset($this->items[$index]);
$this->items = array_values($this->items);
}
public function __clone()
{
$items = array_map(fn($v) => clone $v, $this->items);
return new ArrayNode($items);
}
}