Clean up code.

This commit is contained in:
James Cole
2025-05-04 17:41:26 +02:00
parent e28e538272
commit 0573bf2402
147 changed files with 1758 additions and 1770 deletions

View File

@@ -26,9 +26,9 @@ declare(strict_types=1);
namespace FireflyIII\Support\Search\QueryParser;
use FireflyIII\Exceptions\FireflyException;
use Gdbots\QueryParser\QueryParser as BaseQueryParser;
use Gdbots\QueryParser\Node as GdbotsNode;
use Gdbots\QueryParser\Enum\BoolOperator;
use Gdbots\QueryParser\Node as GdbotsNode;
use Gdbots\QueryParser\QueryParser as BaseQueryParser;
use Illuminate\Support\Facades\Log;
class GdbotsQueryParser implements QueryParserInterface

View File

@@ -34,28 +34,6 @@ abstract class Node
{
protected bool $prohibited;
/**
* Returns the prohibited status of the node, optionally inverted based on flipFlag
*
* Flipping is used when a node is inside a NodeGroup that has a prohibited status itself, causing inversion of the
* query parts inside
*
* @param bool $flipFlag When true, inverts the prohibited status
*
* @return bool The (potentially inverted) prohibited status
*/
public function isProhibited(bool $flipFlag): bool
{
if ($flipFlag) {
// Log::debug(sprintf('This %s is (flipped) now prohibited: %s',get_class($this), var_export(!$this->prohibited, true)));
return !$this->prohibited;
}
// Log::debug(sprintf('This %s is (not flipped) now prohibited: %s',get_class($this), var_export($this->prohibited, true)));
return $this->prohibited;
}
public function equals(self $compare): bool
{
if ($compare->isProhibited(false) !== $this->isProhibited(false)) {
@@ -87,4 +65,26 @@ abstract class Node
return true;
}
/**
* Returns the prohibited status of the node, optionally inverted based on flipFlag
*
* Flipping is used when a node is inside a NodeGroup that has a prohibited status itself, causing inversion of the
* query parts inside
*
* @param bool $flipFlag When true, inverts the prohibited status
*
* @return bool The (potentially inverted) prohibited status
*/
public function isProhibited(bool $flipFlag): bool
{
if ($flipFlag) {
// Log::debug(sprintf('This %s is (flipped) now prohibited: %s',get_class($this), var_export(!$this->prohibited, true)));
return !$this->prohibited;
}
// Log::debug(sprintf('This %s is (not flipped) now prohibited: %s',get_class($this), var_export($this->prohibited, true)));
return $this->prohibited;
}
}

View File

@@ -34,8 +34,8 @@ use Illuminate\Support\Facades\Log;
*/
class QueryParser implements QueryParserInterface
{
private string $query;
private int $position = 0;
private string $query;
public function parse(string $query): NodeGroup
{