Rearrange structure

This commit is contained in:
Sobuno
2025-01-02 22:17:56 +01:00
parent 78f9f7e2dd
commit afc9ea08f3
9 changed files with 143 additions and 129 deletions

View File

@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace FireflyIII\Support\Search\QueryParser;
/**
* Represents a subquery (group of nodes)
*/
class Subquery 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)) . ')';
}
}