forked from koala-framework/koala-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Min.php
47 lines (43 loc) · 1.07 KB
/
Min.php
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
<?php
/**
* @package Model
* @subpackage Expr
*/
class Kwf_Model_Select_Expr_Min implements Kwf_Model_Select_Expr_Interface
{
private $_field;
public function __construct($field)
{
$this->_field = $field;
}
public function getField()
{
return $this->_field;
}
public function validate()
{
$this->_field->validate();
}
public function getResultType()
{
return Kwf_Model_Interface::TYPE_INTEGER;
}
public function toArray()
{
$field = $this->_field;
if ($field instanceof Kwf_Model_Select_Expr_Interface) $field = $field->toArray();
return array(
'exprType' => str_replace('Kwf_Model_Select_Expr_', '', get_class($this)),
'field' => $field,
);
}
public static function fromArray(array $data)
{
$cls = 'Kwf_Model_Select_Expr_'.$data['exprType'];
$field = $data['field'];
if (is_array($field)) {
$field = Kwf_Model_Select_Expr::fromArray($field);
}
return new $cls($field);
}
}