|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Created by PhpStorm. |
| 4 | + * User: inhere |
| 5 | + * Date: 2017-03-17 |
| 6 | + * Time: 11:38 |
| 7 | + */ |
| 8 | + |
| 9 | +namespace inhere\console\utils; |
| 10 | + |
| 11 | +/** |
| 12 | + * Class TraitInteract |
| 13 | + * @package inhere\console\utils |
| 14 | + */ |
| 15 | +trait TraitInteract |
| 16 | +{ |
| 17 | + /** |
| 18 | + * @inheritdoc |
| 19 | + * @see Interact::choice() |
| 20 | + */ |
| 21 | + public function select($description, $options, $default = null, $allowExit=true) |
| 22 | + { |
| 23 | + return self::choice($description, $options, $default, $allowExit); |
| 24 | + } |
| 25 | + public function choice($description, $options, $default = null, $allowExit=true) |
| 26 | + { |
| 27 | + return Interact::choice($description, $options, $default, $allowExit); |
| 28 | + } |
| 29 | + |
| 30 | + /** |
| 31 | + * @inheritdoc |
| 32 | + * @see Interact::confirm() |
| 33 | + */ |
| 34 | + public function confirm($question, $default = true) |
| 35 | + { |
| 36 | + return Interact::confirm($question, $default); |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * @inheritdoc |
| 41 | + * @see Interact::question() |
| 42 | + */ |
| 43 | + public function ask($question, $default = null, \Closure $validator = null) |
| 44 | + { |
| 45 | + return self::question($question, $default, $validator); |
| 46 | + } |
| 47 | + public function question($question, $default = null, \Closure $validator = null) |
| 48 | + { |
| 49 | + return Interact::question($question, $default, $validator); |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * @inheritdoc |
| 54 | + * @see Interact::loopAsk() |
| 55 | + */ |
| 56 | + public function loopAsk($question, $default = null, \Closure $validator = null, $times=3) |
| 57 | + { |
| 58 | + return Interact::loopAsk($question, $default, $validator, $times); |
| 59 | + } |
| 60 | + |
| 61 | +} |
0 commit comments