mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-19 08:00:19 +00:00
Renaming of classes, making true recursive structure
This commit is contained in:
40
app/Support/Search/QueryParser/NodeGroup.php
Normal file
40
app/Support/Search/QueryParser/NodeGroup.php
Normal 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)) . ']';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user