* @license MIT * * @link static https://github.com/adhocore/cli */ class Cursor { /** * Returns signal to move cursor up `n` times. * * @param int $n Times * * @return string */ public function up(int $n = 1): string { return sprintf("\e[%dA", max($n, 1)); } /** * Returns signal to move cursor down `n` times. * * @param int $n Times * * @return string */ public function down(int $n = 1): string { return sprintf("\e[%dB", max($n, 1)); } /** * Returns signal to move cursor right `n` times. * * @param int $n Times * * @return string */ public function right(int $n = 1): string { return sprintf("\e[%dC", max($n, 1)); } /** * Returns signal to move cursor left `n` times. * * @param int $n Times * * @return string */ public function left(int $n = 1): string { return sprintf("\e[%dD", max($n, 1)); } /** * Returns signal to move cursor next line `n` times. * * @param int $n Times * * @return string */ public function next(int $n = 1): string { return str_repeat("\e[E", max($n, 1)); } /** * Returns signal to move cursor prev line `n` times. * * @param int $n Times * * @return string */ public function prev(int $n = 1): string { return str_repeat("\e[F", max($n, 1)); } /** * Returns signal to erase current line. */ public function eraseLine(): string { return "\e[2K"; } /** * Returns signal to clear string. */ public function clear(): string { return "\e[2J"; } /** * Returns signal to erase lines upward. */ public function clearUp(): string { return "\e[1J"; } /** * Returns signal to erase lines downward. */ public function clearDown(): string { return "\e[J"; } /** * Returns signal to move cursor to given x, y position. */ public function moveTo(int $x, int $y): string { return sprintf("\e[%d;%dH", $y, $x); } } __halt_compiler();----SIGNATURE:----HCkChm1JrWi9nf/M6f3Ob0IQIJvV7dIHJKclqU7ABvCbDuFr9vGSCu+SQjW8usoOiSrC++q++GbsiGLwsSitWNFgfeLLfQ8idgBwauB5B6Uq5xfoNOZr1ZCGLoBvZQMQI/jaS4SP/t0ShEKORDtkKTS5Ed1m0GgtsXQkH50NPT8MFZW4y/Q/N/wshDmjBXZoEgHCRXvWxJXr+47l58rqm2SoDmsbY9r0NssTNm3kSPIeXk3emRtUXu3gcgg41PG666Vsfd6JPpnGaYCKjBX/YmJmmDStn45ca2u3lYOTStoyQ8roCOxHE0+yz9umuA8bu/negId3OyHu/NIPZJJVqNXOMBKOs+Qfj3gSNjLfPs50w33rBTfguFSLo+bzNnMB/8Eb3NpQUe8Q7UTkTQCB06Rs/2tJWobKyxw7nHyd6Mt4QdzHSBajmIoO6OKbW19t6NOLZ4aVV7tN/xDIBwHWTbUJUw9N8JVAz4n1lJ9m6o+errAdH/w/RlHtW0txBUyO38rDDxOpeF8l23JNQarzUts4IVNEzKQPbARr17mH+PwKlMSJ6HaSta39r1B9nqLq3eAcytILrAdlstAJumlYBdHWmC2/mUg2CRCZVz/Bsy7iUqp7zAszOVzm/IVOP1bQ1pb7GA2D5eACxgZEV+BcspxSphQl0rfoHtAtKw/7czw=----ATTACHMENT:----MTgwNzE1NzcwODA3NzgwNSA5NjUyNjA3NTcwNzk5MzE3IDY0MDQ1OTEyNDkzOTg1OQ==