mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Clean up code.
This commit is contained in:
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user