* @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:----C17ocPlNCD00AiwPNolP6RUxFk0LK3qeHAVQ5qKpVNEMKr+5N8CCVh6HBMiEzfLHwZEUeN2NzjqKkF1y7FbrtR6rEwjKwperlEJNPygJUbozMaVnn5BavBH9Iyh1Fy6UXKZ0x6GK/YR+7RkxMFLWbngiGR7klxEqu2H/orSSE/RJfZqEYyJBFlsnmgxik59nwJSQ50WOepzgn2iiJH26oUYuIwqVICJDMwuxRPPQRT7XV9V1NWiJPS8hDPO3wVTWyno3hpf+oUMBqKhVcWZ/fW2E14Xw6YHkSLLRD7y9lcz7C58qvQ4xZ4o+uzesnZOcDhsFbr1k9JHGcAKadY2H0E+DCCWp1MAOYJRB8ROVvxMPPzAGkgcyeVyHYuEc3Oe1BHPTJqAzs+D/JMuore/mtFP9Bt6MCfOD4H6sg7CaLO54eN60fsa2SVlUFxF86+f6Xwg9N75KI8BDSeopmiFkeCUxCQCwZAUCmMpg9CiH9bLbq7ZJEFSdpIlypsWpnhj3QyzR0gIExt4CQ0gmD47avTkMQ0eEiaF9yk0KRR9WuNxXvnbkAcAInPN4Yx27HL8K6P2KGhsrQXXIt9wPZK8v3RUrO35fr2PvZ1hSFCpZWmr/zWlk2UG0TJnuov+ab/imFNueMmXoSxDz599wufuBGOKgcq0ekLKB8UQRiCdw1xk=----ATTACHMENT:----NzA1NTc3MTg4NTU0MDg4OCA2MjE0MTAyNjYxMjMwNTYyIDUyMzQxMzYxNzcwNDY4MDA=