forked from ZmotriN/php-wcli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwcli.stub.php
555 lines (502 loc) · 17.8 KB
/
wcli.stub.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
<?php
/**
* COLOR CODES
*/
const Red = 4; // Red color
const Green = 2; // Green color
const Blue = 1; // Blue color
const Yellow = 14; // Yellow color
const Purple = 5; // Purple color
const Aqua = 3; // Aqua color
const White = 7; // White color
const Black = 0; // Black color
const Grey = 8; // Grey color
const Bright = 8; // Bright Flag
/**
* VIRTUAL KEY CODES
* see: https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
*/
const VK_LBUTTON = 0x01; // Left mouse button
const VK_RBUTTON = 0x02; // Right mouse button
const VK_CANCEL = 0x03; // Control-break processing
const VK_MBUTTON = 0x04; // Middle mouse button (three-button mouse)
const VK_XBUTTON1 = 0x05; // X1 mouse button
const VK_XBUTTON2 = 0x06; // X2 mouse button
const VK_BACK = 0x08; // BACKSPACE key
const VK_TAB = 0x09; // TAB key
const VK_CLEAR = 0x0C; // CLEAR key
const VK_RETURN = 0x0D; // ENTER key
const VK_SHIFT = 0x10; // SHIFT key
const VK_CONTROL = 0x11; // CTRL key
const VK_MENU = 0x12; // ALT key
const VK_PAUSE = 0x13; // PAUSE key
const VK_CAPITAL = 0x14; // CAPS LOCK key
const VK_KANA = 0x15; // IME Kana mode
const VK_HANGUEL = 0x15; // IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
const VK_HANGUL = 0x15; // IME Hangul mode
const VK_JUNJA = 0x17; // IME Junja mode
const VK_FINAL = 0x18; // IME final mode
const VK_HANJA = 0x19; // IME Hanja mode
const VK_KANJI = 0x19; // IME Kanji mode
const VK_ESCAPE = 0x1B; // ESC key
const VK_CONVERT = 0x1C; // IME convert
const VK_NONCONVERT = 0x1D; // IME nonconvert
const VK_ACCEPT = 0x1E; // IME accept
const VK_MODECHANGE = 0x1F; // IME mode change request
const VK_SPACE = 0x20; // SPACEBAR
const VK_PRIOR = 0x21; // PAGE UP key
const VK_NEXT = 0x22; // PAGE DOWN key
const VK_END = 0x23; // END key
const VK_HOME = 0x24; // HOME key
const VK_LEFT = 0x25; // LEFT ARROW key
const VK_UP = 0x26; // UP ARROW key
const VK_RIGHT = 0x27; // RIGHT ARROW key
const VK_DOWN = 0x28; // DOWN ARROW key
const VK_SELECT = 0x29; // SELECT key
const VK_PRINT = 0x2A; // PRINT key
const VK_EXECUTE = 0x2B; // EXECUTE key
const VK_SNAPSHOT = 0x2C; // PRINT SCREEN key
const VK_INSERT = 0x2D; // INS key
const VK_DELETE = 0x2E; // DEL key
const VK_HELP = 0x2F; // HELP key
const VK_LWIN = 0x5B; // Left Windows key (Natural keyboard)
const VK_RWIN = 0x5C; // Right Windows key (Natural keyboard)
const VK_APPS = 0x5D; // Applications key (Natural keyboard)
const VK_SLEEP = 0x5F; // Computer Sleep key
const VK_NUMPAD0 = 0x60; // Numeric keypad 0 key
const VK_NUMPAD1 = 0x61; // Numeric keypad 1 key
const VK_NUMPAD2 = 0x62; // Numeric keypad 2 key
const VK_NUMPAD3 = 0x63; // Numeric keypad 3 key
const VK_NUMPAD4 = 0x64; // Numeric keypad 4 key
const VK_NUMPAD5 = 0x65; // Numeric keypad 5 key
const VK_NUMPAD6 = 0x66; // Numeric keypad 6 key
const VK_NUMPAD7 = 0x67; // Numeric keypad 7 key
const VK_NUMPAD8 = 0x68; // Numeric keypad 8 key
const VK_NUMPAD9 = 0x69; // Numeric keypad 9 key
const VK_MULTIPLY = 0x6A; // Multiply key
const VK_ADD = 0x6B; // Add key
const VK_SEPARATOR = 0x6C; // Separator key
const VK_SUBTRACT = 0x6D; // Subtract key
const VK_DECIMAL = 0x6E; // Decimal key
const VK_DIVIDE = 0x6F; // Divide key
const VK_F1 = 0x70; // F1 key
const VK_F2 = 0x71; // F2 key
const VK_F3 = 0x72; // F3 key
const VK_F4 = 0x73; // F4 key
const VK_F5 = 0x74; // F5 key
const VK_F6 = 0x75; // F6 key
const VK_F7 = 0x76; // F7 key
const VK_F8 = 0x77; // F8 key
const VK_F9 = 0x78; // F9 key
const VK_F10 = 0x79; // F10 key
const VK_F11 = 0x7A; // F11 key
const VK_F12 = 0x7B; // F12 key
const VK_F13 = 0x7C; // F13 key
const VK_F14 = 0x7D; // F14 key
const VK_F15 = 0x7E; // F15 key
const VK_F16 = 0x7F; // F16 key
const VK_F17 = 0x80; // F17 key
const VK_F18 = 0x81; // F18 key
const VK_F19 = 0x82; // F19 key
const VK_F20 = 0x83; // F20 key
const VK_F21 = 0x84; // F21 key
const VK_F22 = 0x85; // F22 key
const VK_F23 = 0x86; // F23 key
const VK_F24 = 0x87; // F24 key
const VK_NUMLOCK = 0x90; // NUM LOCK key
const VK_SCROLL = 0x91; // SCROLL LOCK key
const VK_LSHIFT = 0xA0; // Left SHIFT key
const VK_RSHIFT = 0xA1; // Right SHIFT key
const VK_LCONTROL = 0xA2; // Left CONTROL key
const VK_RCONTROL = 0xA3; // Right CONTROL key
const VK_LMENU = 0xA4; // Left MENU key
const VK_RMENU = 0xA5; // Right MENU key
const VK_BROWSER_BACK = 0xA6; // Browser Back key
const VK_BROWSER_FORWARD = 0xA7; // Browser Forward key
const VK_BROWSER_REFRESH = 0xA8; // Browser Refresh key
const VK_BROWSER_STOP = 0xA9; // Browser Stop key
const VK_BROWSER_SEARCH = 0xAA; // Browser Search key
const VK_BROWSER_FAVORITES = 0xAB; // Browser Favorites key
const VK_BROWSER_HOME = 0xAC; // Browser Start and Home key
const VK_VOLUME_MUTE = 0xAD; // Volume Mute key
const VK_VOLUME_DOWN = 0xAE; // Volume Down key
const VK_VOLUME_UP = 0xAF; // Volume Up key
const VK_MEDIA_NEXT_TRACK = 0xB0; // Next Track key
const VK_MEDIA_PREV_TRACK = 0xB1; // Previous Track key
const VK_MEDIA_STOP = 0xB2; // Stop Media key
const VK_MEDIA_PLAY_PAUSE = 0xB3; // Play/Pause Media key
const VK_LAUNCH_MAIL = 0xB4; // Start Mail key
const VK_LAUNCH_MEDIA_SELECT = 0xB5; // Select Media key
const VK_LAUNCH_APP1 = 0xB6; // Start Application 1 key
const VK_LAUNCH_APP2 = 0xB7; // Start Application 2 key
const VK_OEM_1 = 0xBA; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ';:' key
const VK_OEM_PLUS = 0xBB; // For any country/region, the '+' key
const VK_OEM_COMMA = 0xBC; // For any country/region, the ',' key
const VK_OEM_MINUS = 0xBD; // For any country/region, the '-' key
const VK_OEM_PERIOD = 0xBE; // For any country/region, the '.' key
const VK_OEM_2 = 0xBF; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '/?' key
const VK_OEM_3 = 0xC0; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '`~' key
const VK_OEM_4 = 0xDB; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '[{' key
const VK_OEM_5 = 0xDC; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '\|' key
const VK_OEM_6 = 0xDD; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ']}' key
const VK_OEM_7 = 0xDE; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the 'single-quote/double-quote' key
const VK_OEM_8 = 0xDF; // Used for miscellaneous characters; it can vary by keyboard.
const VK_OEM_102 = 0xE2; // Either the angle bracket key or the backslash key on the RT 102-key keyboard
const VK_PROCESSKEY = 0xE5; // IME PROCESS key
const VK_PACKET = 0xE7; // Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP
const VK_ATTN = 0xF6; // Attn key
const VK_CRSEL = 0xF7; // CrSel key
const VK_EXSEL = 0xF8; // ExSel key
const VK_EREOF = 0xF9; // Erase EOF key
const VK_PLAY = 0xFA; // Play key
const VK_ZOOM = 0xFB; // Zoom key
const VK_NONAME = 0xFC; // Reserved
const VK_PA1 = 0xFD; // PA1 key
const VK_OEM_CLEAR = 0xFE; // Clear key
const VK_0 = 0x30; // 0 key
const VK_1 = 0x31; // 1 key
const VK_2 = 0x32; // 2 key
const VK_3 = 0x33; // 3 key
const VK_4 = 0x34; // 4 key
const VK_5 = 0x35; // 5 key
const VK_6 = 0x36; // 6 key
const VK_7 = 0x37; // 7 key
const VK_8 = 0x38; // 8 key
const VK_9 = 0x39; // 9 key
const VK_A = 0x41; // A key
const VK_B = 0x42; // B key
const VK_C = 0x43; // C key
const VK_D = 0x44; // D key
const VK_E = 0x45; // E key
const VK_F = 0x46; // F key
const VK_G = 0x47; // G key
const VK_H = 0x48; // H key
const VK_I = 0x49; // I key
const VK_J = 0x4A; // J key
const VK_K = 0x4B; // K key
const VK_L = 0x4C; // L key
const VK_M = 0x4D; // M key
const VK_N = 0x4E; // N key
const VK_O = 0x4F; // O key
const VK_P = 0x50; // P key
const VK_Q = 0x51; // Q key
const VK_R = 0x52; // R key
const VK_S = 0x53; // S key
const VK_T = 0x54; // T key
const VK_U = 0x55; // U key
const VK_V = 0x56; // V key
const VK_W = 0x57; // W key
const VK_X = 0x58; // X key
const VK_Y = 0x59; // Y key
const VK_Z = 0x5A; // Z key
/**
* Get the console output handle.
* @return int|bool
*/
function wcli_get_output_handle() : int|bool{}
/**
* Get the console input handle.
* @return int|bool
*/
function wcli_get_input_handle() : int|bool{}
/**
* Get the console window handle.
* @return int|bool
*/
function wcli_get_window_handle() : int|bool{}
/**
* Retrun the console title, otherwise false.
* @return string|bool
*/
function wcli_get_console_title() : string|bool{}
/**
* Set the console title.
* @param string $title
* @return bool
*/
function wcli_set_console_title(string $title) : bool{}
/**
* Retrieve the size and the scrolling in characters of the console.
* Return an array [w, h, x, y]
* @return array|bool
*/
function wcli_get_console_size() : array|bool{}
/**
* Set the console size in characters.
* Set the $force parameter to true to force the buffer at the same size.
*
* @param int $w Width of the console in characters
* @param int $h Height of the console in characters
* @param bool $force Default false.
*
* @return bool True if success, else false.
*/
function wcli_set_console_size(int $w, int $h, bool $force = false) : bool{}
/**
* Retrieve console buffer size in characters.
* Return an array [w, h]
* @return array|bool
*/
function wcli_get_buffer_size() : array|bool{}
/**
* Set the console buffer size in characters.
* The buffer size need to be bigger than the console size.
* Otherwise, set the console size before the buffer size.
*
* @param int $w Width of the buffer in characters
* @param int $h Height of the buffer in characters
*
* @return bool True if success, else false.
*/
function wcli_set_buffer_size(int $w, int $h) : bool{}
/**
* Retrieves the input code page used by the console.
* See: https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
* @return int
*/
function wcli_get_code_page() : int{}
/**
* Set the input code page used by the console.
* See: https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
*
* @param int $cpID Code Page ID
*
* @return bool True if success, else false.
*/
function wcli_set_code_page(int $cp) : bool{}
/**
* Retrieve console font size in pixels.
* Return an array [width, height]
* @return array|bool The font size, otherwise false.
*/
function wcli_get_font_size() : array|bool{}
/**
* Get the foreground color.
* @return int|bool
*/
function wcli_get_foreground_color() : int|bool{}
/**
* Set the foreground color.
* @param int $fore
* @return bool
*/
function wcli_set_foreground_color(int $fore) : bool{}
/**
* Get the background color.
* @return int|bool
*/
function wcli_get_background_color() : int|bool{}
/**
* Set the background color.
* @param int $back
* @return bool
*/
function wcli_set_background_color(int $back) : bool{}
/**
* Retrieve console foreground and background colors.
* Return an array [foreColor, backColor]
* @return array|bool
*/
function wcli_get_colors() : array|bool{}
/**
* Set the foreground and background color at once.
* @param int $fore
* @param int $back
* @return bool
*/
function wcli_set_colors(int $fore, int $back) : bool{}
/**
* Swap foreground and background colors.
* @return bool
*/
function wcli_inverse_colors() : bool{}
/**
* Reset console colors to default.
* @return bool
*/
function wcli_reset_colors() : bool{}
/**
* Hide console cursor.
* @return bool
*/
function wcli_hide_cursor() : bool{}
/**
* Show console cursor.
* @return bool
*/
function wcli_show_cursor() : bool{}
/**
* Retrieve cursor visibility.
* @return bool
*/
function wcli_get_cursor_visibility() : bool{}
/**
* Set cursor visibility.
* @param bool $visible
* @return bool
*/
function wcli_set_cursor_visibility(bool $visible) : bool{}
/**
* Retrieve cursor size.
* The size value is between 0 and 100.
* @return int|bool
*/
function wcli_get_cursor_size() : int|bool{}
/**
* Set cursor size. Cursor size between 0 and 100.
* @param int $size
* @return bool
*/
function wcli_set_cursor_size(int $size) : bool{}
/**
* Retrieve cursor position.
* Return an array [x, y]
* @return array|bool
*/
function wcli_get_cursor_position() : array|bool{}
/**
* Set cursor position.
* @param int $x
* @param int $y
* @return bool
*/
function wcli_set_cursor_position(int $x, int $y) : bool{}
/**
* Move cursor position relatively to the current cursor position.
* @param int $x
* @param int $y
* @return bool
*/
function wcli_move_cursor(int $x, int $y) : bool{}
/**
* Echo string with colors. Foreground and background colors are optionals.
* @param string $str
* @param int|null $fore
* @param int|null $back
* @return bool
*/
function wcli_echo(string $str, ?int $fore = '', ?int $back = '') : bool{}
/**
* Print string with colors at the x-y position without changing cursor position.
* @param string $str
* @param int|null $x
* @param int|null $y
* @param int|null $fore
* @param int|null $back
* @return bool
*/
function wcli_print(string $str, ?int $x = '', ?int $y = '', ?int $fore = '', ?int $back = '') : bool{}
/**
* Clear the console.
* @return bool
*/
function wcli_clear() : bool{}
/**
* Method fill rect with character and colors.
* @param int $c
* @param int $x
* @param int $y
* @param int $w
* @param int $h
* @param int|null $fore
* @param int|null $back
* @return bool
*/
function wcli_fill(int $c, int $x, int $y, int $w, int $h, ?int $fore = '', ?int $back = '') : bool{}
/**
* Pause process and wait for a keyboard input.
* @return int|bool
*/
function wcli_get_key() : int|bool{}
/**
* Get an async keyboard input.
* @return int|bool
*/
function wcli_get_key_async() : int|bool{}
/**
* Flush console input buffer.
* @return bool
*/
function wcli_flush_input_buffer() : bool{}
/**
* Verify if console window is on top.
* @return bool
*/
function wcli_is_on_top() : bool{}
/**
* Verify if console window is visible.
* @return bool
*/
function wcli_is_visible() : bool{}
/**
* Retrieve console window area.
* Return an array [x, y, width, height]
* @return array|bool
*/
function wcli_get_window_area() : array|bool{}
/**
* Retrieve console window inner area.
* Return an array [x, y, width, height]
* @return array|bool
*/
function wcli_get_client_area() : array|bool{}
/**
* Minimize console window.
* @return bool
*/
function wcli_minimize() : bool{}
/**
* Maximize console window.
* @return bool
*/
function wcli_maximize() : bool{}
/**
* Restore console window.
* @return bool
*/
function wcli_restore() : bool{}
/**
* Force console window to activate.
* @return bool
*/
function wcli_activate() : bool{}
/**
* Flash console window.
* @param bool|null $invert
* @return bool
*/
function wcli_flash(?bool $invert = false) : bool{}
/**
* Bring console window to front.
* @return bool
*/
function wcli_bring_to_front() : bool{}
/**
* Set console window position.
* @param int $x
* @param int $y
* @return bool
*/
function wcli_set_position(int $x, int $y) : bool{}
/**
* Return module/executable full path.
* Useful for SAPI.
* @return string
*/
function wcli_get_module_path() : string{}
/**
* Get parent process ID.
* @return int|bool
*/
function wcli_get_parent_pid() : int|bool{}
/**
* Know if the process was lunch by a terminal.
* @return bool
*/
function wcli_is_cmd_call() : bool{}
/**
* Search filename in environment path.
* @param string $file
* @return string|bool
*/
function wcli_where(string $file) : string|bool{}