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

33
src/Tree/ObjectNode.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace NoccyLabs\JEdit\Tree;
class ObjectNode extends Node implements CollapsibleNode
{
use CollapsibleNodeTrait;
public function __construct(public array $properties)
{
}
public function set(string $key, Node $value)
{
$this->properties[$key] = $value;
}
public function unset(string $key)
{
unset($this->properties[$key]);
}
public function __clone()
{
$properties = array_combine(
array_keys($this->properties),
array_map(fn($v) => clone $v, $this->properties)
);
return new ObjectNode($properties);
}
}