Comparison.php
731 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace ACP\Search\Helper\Sql;
use ACP\Search\Value;
class Comparison extends Statement {
/**
* @var string
*/
protected $column;
/**
* @var string
*/
protected $operator;
/**
* @param string $column
* @param string $operator
* @param Value $value
*/
public function __construct( $column, $operator, Value $value ) {
$this->column = $column;
$this->operator = $operator;
$this->bind_value( $value );
parent::__construct( $this->get_statement() );
}
/**
* @return string
*/
protected function get_statement() {
return sprintf( '%s %s ?',
$this->column,
$this->operator
);
}
/**
* @return string
*/
public function __invoke() {
return $this->prepare();
}
}