2021-01-25 12:35:32 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2020-12-22 14:19:32 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 https://rewiv.com sikofitt@gmail.com
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the
|
|
|
|
* terms of the Mozilla Public License, v. 2.0.
|
|
|
|
*
|
|
|
|
* If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
2021-01-25 12:35:32 -08:00
|
|
|
use Sikofitt\Console\Getch;
|
2020-12-22 14:19:32 -08:00
|
|
|
|
|
|
|
if (!function_exists('getch')) {
|
2024-07-18 12:34:40 -07:00
|
|
|
function getch(?string $linuxLibrary = null): int
|
2020-12-22 14:19:32 -08:00
|
|
|
{
|
2024-07-18 12:34:40 -07:00
|
|
|
return (new Getch($linuxLibrary))->getch();
|
2020-12-22 14:19:32 -08:00
|
|
|
}
|
|
|
|
}
|
2021-01-07 13:58:46 -08:00
|
|
|
|
2021-01-25 12:35:32 -08:00
|
|
|
if (!function_exists('ungetch')) {
|
2024-07-18 12:34:40 -07:00
|
|
|
function ungetch($char, ?string $linuxLibrary = null): int
|
2021-01-07 13:58:46 -08:00
|
|
|
{
|
2024-07-18 12:34:40 -07:00
|
|
|
return (new Getch($linuxLibrary))->ungetch($char);
|
2021-01-07 13:58:46 -08:00
|
|
|
}
|
|
|
|
}
|