blob: 1123cf3ba25eadff47d633ef2c8b731f2401c528 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<?php
namespace Micropoly\Search;
class FTSExpr extends AbstractFTSExpr
{
private string $term;
public function __construct(string $term)
{
$this->term = $term;
}
public function getTerm(): string
{
return $this->term;
}
protected function fts4Query(): string
{
return '"' . str_replace('"', '""', $this->term) . '"';
}
public function toString(): string
{
return '"' . preg_replace_callback('/(["\\\\])/', fn($s) => "\\$s", $this->term) . '"';
}
}
|