1 | <?php |
||
7 | class FieldsFactory |
||
8 | { |
||
9 | /** |
||
10 | * list of all the available field classes |
||
11 | * ordered in infer order - the most strict field first |
||
12 | */ |
||
13 | public static $fieldClasses = [ |
||
14 | "\\frictionlessdata\\tableschema\\Fields\\IntegerField", |
||
15 | "\\frictionlessdata\\tableschema\\Fields\\NumberField", |
||
16 | "\\frictionlessdata\\tableschema\\Fields\\StringField", |
||
17 | ]; |
||
18 | |||
19 | /** |
||
20 | * get a new field object in the correct type according to the descriptor |
||
21 | * @param object $descriptor |
||
22 | * @return BaseField |
||
23 | * @throws \Exception |
||
24 | */ |
||
25 | public static function field($descriptor) |
||
39 | |||
40 | /** |
||
41 | * @param $val |
||
42 | * @param null $descriptor |
||
43 | * @return mixed |
||
44 | * @throws FieldValidationException |
||
45 | */ |
||
46 | public static function infer($val, $descriptor=null, $lenient=false) |
||
60 | } |