@@ 158-173 (lines=16) @@ | ||
155 | * |
|
156 | * @throws UnexpectedValueException if the input is invalid (assumes valid input) |
|
157 | */ |
|
158 | public function getValue(InputModel $model) |
|
159 | { |
|
160 | $input = $model->getInput($this); |
|
161 | ||
162 | if ($input === null) { |
|
163 | return null; |
|
164 | } |
|
165 | ||
166 | $value = $this->parseInput($input); |
|
167 | ||
168 | if ($value === null) { |
|
169 | throw new UnexpectedValueException("invalid date input"); |
|
170 | } |
|
171 | ||
172 | return $value; |
|
173 | } |
|
174 | ||
175 | /** |
|
176 | * @param InputModel $model |
@@ 68-83 (lines=16) @@ | ||
65 | * |
|
66 | * @throws UnexpectedValueException if unable to parse the input |
|
67 | */ |
|
68 | public function getValue(InputModel $model) |
|
69 | { |
|
70 | $input = $model->getInput($this); |
|
71 | ||
72 | if (empty($input)) { |
|
73 | return null; |
|
74 | } else { |
|
75 | $value = $this->parseInput($input); |
|
76 | ||
77 | if ($value === null) { |
|
78 | throw new UnexpectedValueException("invalid input"); |
|
79 | } |
|
80 | ||
81 | return $value; |
|
82 | } |
|
83 | } |
|
84 | ||
85 | /** |
|
86 | * @param InputModel $model |
@@ 58-71 (lines=14) @@ | ||
55 | * |
|
56 | * @throws UnexpectedValueException if unable to parse the input |
|
57 | */ |
|
58 | public function getValue(InputModel $model) |
|
59 | { |
|
60 | $input = $model->getInput($this); |
|
61 | ||
62 | if ($input === null) { |
|
63 | return null; // no input available |
|
64 | } |
|
65 | ||
66 | if (is_numeric($input)) { |
|
67 | return (int) $input; |
|
68 | } |
|
69 | ||
70 | throw new UnexpectedValueException("unexpected input: {$input}"); |
|
71 | } |
|
72 | ||
73 | /** |
|
74 | * @param InputModel $model |