Fix bin/publish: copy docs.dist from project root

Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-21 02:08:33 +00:00
commit f6fac6c4bc
79758 changed files with 10547827 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
<?php
/**
* Copyright (c) 2013-2024 Nicolò Martini
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/nicmart/Tree
*/
namespace Tree\Builder;
use Tree\Node\Node;
use Tree\Node\NodeInterface;
/**
* Main implementation of the NodeBuilderInterface.
*/
class NodeBuilder implements NodeBuilderInterface
{
/**
* @var array<int, NodeInterface>
*/
private array $nodeStack = [];
public function __construct(?NodeInterface $node = null)
{
$this->setNode($node ?: $this->nodeInstanceByValue());
}
public function setNode(NodeInterface $node): static
{
$this
->emptyStack()
->pushNode($node);
return $this;
}
public function getNode(): NodeInterface
{
$count = \count($this->nodeStack);
if (0 === $count) {
throw new \LogicException('The node builder currently does not manage any nodes.');
}
return $this->nodeStack[$count - 1];
}
public function leaf(mixed $value = null): static
{
$this->getNode()->addChild(
$this->nodeInstanceByValue($value),
);
return $this;
}
public function leafs(mixed ...$values): static
{
foreach ($values as $value) {
$this->leaf($value);
}
return $this;
}
public function tree(mixed $value = null): static
{
$node = $this->nodeInstanceByValue($value);
$this->getNode()->addChild($node);
$this->pushNode($node);
return $this;
}
public function end(): ?static
{
$this->popNode();
return $this;
}
public function nodeInstanceByValue(mixed $value = null): NodeInterface
{
return new Node($value);
}
public function value(mixed $value): static
{
$this->getNode()->setValue($value);
return $this;
}
private function emptyStack(): static
{
$this->nodeStack = [];
return $this;
}
private function pushNode(NodeInterface $node): static
{
$this->nodeStack[] = $node;
return $this;
}
private function popNode(): void
{
\array_pop($this->nodeStack);
}
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* Copyright (c) 2013-2024 Nicolò Martini
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/nicmart/Tree
*/
namespace Tree\Builder;
use Tree\Node\NodeInterface;
/**
* Interface that allows a fluent tree building.
*
* @author Nicolò Martini <nicmartnic@gmail.com>
*/
interface NodeBuilderInterface
{
/**
* Set the node the builder will manage.
*/
public function setNode(NodeInterface $node): static;
/**
* Get the node the builder manages.
*
* @throws \LogicException
*/
public function getNode(): NodeInterface;
/**
* Set the value of the underlaying node.
*/
public function value(mixed $value): static;
/**
* Add a leaf to the node.
*/
public function leaf(mixed $value = null): static;
/**
* Add several leafs to the node.
*/
public function leafs(mixed ...$values): static;
/**
* Add a child to the node enter in its scope.
*/
public function tree(mixed $value = null): static;
/**
* Goes up to the parent node context.
*/
public function end(): ?static;
/**
* Return a node instance set with the given value. Implementation can follow their own logic
* in choosing the NodeInterface implmentation taking into account the value.
*/
public function nodeInstanceByValue(mixed $value = null): NodeInterface;
}