1 | <?php |
||
8 | class Checkboxes extends InputAbstract |
||
9 | { |
||
10 | /** |
||
11 | * The options to choose from |
||
12 | * |
||
13 | * @var Checkbox\CheckboxGroup $checkboxes |
||
14 | */ |
||
15 | protected $checkboxes; |
||
16 | |||
17 | 16 | public function __construct($prompt, array $options, ReaderInterface $reader = null) |
|
24 | |||
25 | /** |
||
26 | * Do it! Prompt the user for information! |
||
27 | * |
||
28 | * @return string |
||
29 | */ |
||
30 | 16 | public function prompt() |
|
40 | |||
41 | /** |
||
42 | * Build out the checkboxes |
||
43 | * |
||
44 | * @param array $options |
||
45 | * |
||
46 | * @return Checkbox\CheckboxGroup |
||
47 | */ |
||
48 | 12 | protected function buildCheckboxes(array $options) |
|
52 | |||
53 | /** |
||
54 | * Format the prompt string |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | 16 | protected function promptFormatted() |
|
62 | |||
63 | /** |
||
64 | * Output the checkboxes and listen for any keystrokes |
||
65 | */ |
||
66 | 16 | protected function writeCheckboxes() |
|
75 | |||
76 | /** |
||
77 | * Listen for input and act on it |
||
78 | */ |
||
79 | 16 | protected function listenForInput() |
|
90 | |||
91 | /** |
||
92 | * Take the appropriate action based on the input character, |
||
93 | * returns whether to stop listening or not |
||
94 | * |
||
95 | * @param string $char |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | 16 | protected function handleCharacter($char) |
|
118 | |||
119 | /** |
||
120 | * Move the cursor to the top of the option list |
||
121 | */ |
||
122 | 16 | protected function moveCursorToTop() |
|
129 | |||
130 | /** |
||
131 | * Handle any ANSI characters |
||
132 | */ |
||
133 | 8 | protected function handleAnsi() |
|
147 | |||
148 | /** |
||
149 | * Re-write the checkboxes based on the current objects |
||
150 | */ |
||
151 | 16 | protected function updateCheckboxView() |
|
159 | } |
||
160 |