|
@@ 257-263 (lines=7) @@
|
| 254 |
|
$input = trim(static::input()) ?: $default; |
| 255 |
|
|
| 256 |
|
// No input provided and we require one (default will stop this being called) |
| 257 |
|
if (empty($input) and $required === true) |
| 258 |
|
{ |
| 259 |
|
static::write('This is required.'); |
| 260 |
|
static::new_line(); |
| 261 |
|
|
| 262 |
|
$input = forward_static_call_array(array(__CLASS__, 'prompt'), $args); |
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
// If options are provided and the choice is not in the array, tell them to try again |
| 266 |
|
if ( ! empty($options) and ! in_array($input, $options)) |
|
@@ 266-272 (lines=7) @@
|
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
// If options are provided and the choice is not in the array, tell them to try again |
| 266 |
|
if ( ! empty($options) and ! in_array($input, $options)) |
| 267 |
|
{ |
| 268 |
|
static::write('This is not a valid option. Please try again.'); |
| 269 |
|
static::new_line(); |
| 270 |
|
|
| 271 |
|
$input = forward_static_call_array(array(__CLASS__, 'prompt'), $args); |
| 272 |
|
} |
| 273 |
|
|
| 274 |
|
return $input; |
| 275 |
|
} |