Renaming of classes, making true recursive structure

This commit is contained in:
Sobuno
2025-01-02 23:19:21 +01:00
parent 2ae3929dd6
commit af7a4b5d3d
7 changed files with 66 additions and 52 deletions

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace FireflyIII\Support\Search\QueryParser;
/**
* Represents a group of nodes.
*
* NodeGroups can be nested inside other NodeGroups, making them subqueries
*/
class NodeGroup extends Node
{
/** @var Node[] */
private array $nodes;
/**
* @param Node[] $nodes
* @param bool $prohibited
*/
public function __construct(array $nodes, bool $prohibited = false)
{
$this->nodes = $nodes;
$this->prohibited = $prohibited;
}
/**
* @return Node[]
*/
public function getNodes(): array
{
return $this->nodes;
}
public function __toString(): string
{
return ($this->prohibited ? '-' : '') . '[' . implode(' ', array_map(fn($node) => (string)$node, $this->nodes)) . ']';
}
}