Update dependencies

This commit is contained in:
R. Eric Wheeler 2022-05-10 22:28:54 -07:00
parent 2ed1abf0fc
commit 6405f1c7b9
2 changed files with 553 additions and 401 deletions

947
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -72,13 +72,13 @@ final class Getch
if (null === self::$ffi) {
$osFamily = PHP_OS_FAMILY;
if ('Windows' === $osFamily) {
$declarations = self::DECLARATIONS . ' int _kbhit();';
$declarations = self::DECLARATIONS.' int _kbhit();';
self::$ffi = FFI::cdef($declarations, self::WINDOWS_LIBRARY);
} elseif ('Linux' === $osFamily) {
if (!file_exists($linuxLibrary)) {
throw new RuntimeException(sprintf('Could not find library file %s.', $linuxLibrary));
}
$declarations = self::DECLARATIONS . ' int cinPeek();';
$declarations = self::DECLARATIONS.' int cinPeek();';
self::$ffi = FFI::cdef($declarations, $linuxLibrary);
} else {
throw new RuntimeException(sprintf('Sorry, %s is not supported yet.', $osFamily));
@ -92,10 +92,13 @@ final class Getch
if ($ffi->_kbhit()) {
$result = $ffi->_getch();
$ffi->_ungetch($result);
return $result;
}
return -1;
}
return $ffi->cinPeek();
}