diff options
Diffstat (limited to 'src/Search/NotOp.php')
-rw-r--r-- | src/Search/NotOp.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Search/NotOp.php b/src/Search/NotOp.php new file mode 100644 index 0000000..35fcf1e --- /dev/null +++ b/src/Search/NotOp.php @@ -0,0 +1,32 @@ +<?php + + +namespace Micropoly\Search; + + +class NotOp implements SearchExpr +{ + private SearchExpr $expr; + + public function __construct(SearchExpr $expr) + { + $this->expr = $expr; + } + + public function toString(): string + { + return "not ({$this->expr->toString()})"; + } + + public function toSQL(string $bindPrefix, bool $singleFTS): SQLSearchExpr + { + $sqlex = $this->expr->toSQL($bindPrefix, $singleFTS); + $sqlex->sql = "(NOT ({$sqlex->sql}))"; + return $sqlex; + } + + public function countFTSQueries(): int + { + return $this->expr->countFTSQueries(); + } +}
\ No newline at end of file |