1 | <?php |
||
9 | class DataTypeGuesser implements FormTypeGuesserInterface |
||
10 | { |
||
11 | private $data; |
||
12 | |||
13 | public function setData($data = null) |
||
14 | { |
||
15 | $this->data = $data; |
||
16 | } |
||
17 | |||
18 | public function guessType($class, $property) |
||
19 | { |
||
20 | if ($property === '_id') { |
||
21 | return new TypeGuess('hidden', array(), Guess::LOW_CONFIDENCE); |
||
22 | } |
||
23 | |||
24 | if (!isset($this->data->$property)) { |
||
25 | return; |
||
26 | } |
||
27 | $data = $this->data->$property; |
||
28 | |||
29 | $type = $this->getType($data); |
||
30 | |||
31 | return new TypeGuess($type, array(), Guess::LOW_CONFIDENCE); |
||
32 | } |
||
33 | |||
34 | public function guessRequired($class, $property) |
||
35 | { |
||
36 | } |
||
37 | |||
38 | public function guessPattern($class, $property) |
||
39 | { |
||
40 | } |
||
41 | |||
42 | public function guessMaxLength($class, $property) |
||
43 | { |
||
44 | } |
||
45 | |||
46 | public function guessMinLength($class, $property) |
||
47 | { |
||
48 | } |
||
49 | |||
50 | private function getType($value) |
||
73 | } |
||
74 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.