From 2ed1abf0fc0d26be4a65f863ae95ae64c476945c Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Mon, 1 Mar 2021 10:48:18 -0800 Subject: [PATCH] removed function ungetchString --- functions.php | 9 --------- src/Console/Getch.php | 19 ++----------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/functions.php b/functions.php index bf6a4bd..64443ca 100644 --- a/functions.php +++ b/functions.php @@ -31,12 +31,3 @@ if (!function_exists('ungetch')) { return $g->ungetch($char); } } - -if (!function_exists('ungetchString')) { - function ungetchString(string $string, string $linuxLibrary = null): bool - { - $g = new Getch($linuxLibrary); - - return $g->ungetchString($string); - } -} diff --git a/src/Console/Getch.php b/src/Console/Getch.php index 240f9e1..5a8f6c3 100644 --- a/src/Console/Getch.php +++ b/src/Console/Getch.php @@ -88,8 +88,8 @@ final class Getch public function peek(): int { - if(PHP_OS_FAMILY === 'Windows') { - if($ffi->_kbhit()) { + if (PHP_OS_FAMILY === 'Windows') { + if ($ffi->_kbhit()) { $result = $ffi->_getch(); $ffi->_ungetch($result); return $result; @@ -98,21 +98,6 @@ final class Getch } return $ffi->cinPeek(); } -/* public function keyCode(string $device): array - { - - $arrayType = \FFI::arrayType(self::$ffi->type('int'), [3]); - $res = \FFI::new($arrayType); - - $arrayType = self::$ffi->keyCode($device); - - return [ - 'type' => $arrayType[0], - 'code' => $arrayType[1], - 'value' => $arrayType[2], - 'keyCode' => $arrayType[3], - ]; - }*/ public function getch(): int {