cleaned up composer
This commit is contained in:
Vendored
+39
@@ -21,12 +21,18 @@ final class Cursor
|
||||
private $output;
|
||||
private $input;
|
||||
|
||||
/**
|
||||
* @param resource|null $input
|
||||
*/
|
||||
public function __construct(OutputInterface $output, $input = null)
|
||||
{
|
||||
$this->output = $output;
|
||||
$this->input = $input ?? (\defined('STDIN') ? \STDIN : fopen('php://input', 'r+'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function moveUp(int $lines = 1): self
|
||||
{
|
||||
$this->output->write(sprintf("\x1b[%dA", $lines));
|
||||
@@ -34,6 +40,9 @@ final class Cursor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function moveDown(int $lines = 1): self
|
||||
{
|
||||
$this->output->write(sprintf("\x1b[%dB", $lines));
|
||||
@@ -41,6 +50,9 @@ final class Cursor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function moveRight(int $columns = 1): self
|
||||
{
|
||||
$this->output->write(sprintf("\x1b[%dC", $columns));
|
||||
@@ -48,6 +60,9 @@ final class Cursor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function moveLeft(int $columns = 1): self
|
||||
{
|
||||
$this->output->write(sprintf("\x1b[%dD", $columns));
|
||||
@@ -55,6 +70,9 @@ final class Cursor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function moveToColumn(int $column): self
|
||||
{
|
||||
$this->output->write(sprintf("\x1b[%dG", $column));
|
||||
@@ -62,6 +80,9 @@ final class Cursor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function moveToPosition(int $column, int $row): self
|
||||
{
|
||||
$this->output->write(sprintf("\x1b[%d;%dH", $row + 1, $column));
|
||||
@@ -69,6 +90,9 @@ final class Cursor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function savePosition(): self
|
||||
{
|
||||
$this->output->write("\x1b7");
|
||||
@@ -76,6 +100,9 @@ final class Cursor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function restorePosition(): self
|
||||
{
|
||||
$this->output->write("\x1b8");
|
||||
@@ -83,6 +110,9 @@ final class Cursor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function hide(): self
|
||||
{
|
||||
$this->output->write("\x1b[?25l");
|
||||
@@ -90,6 +120,9 @@ final class Cursor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function show(): self
|
||||
{
|
||||
$this->output->write("\x1b[?25h\x1b[?0c");
|
||||
@@ -99,6 +132,8 @@ final class Cursor
|
||||
|
||||
/**
|
||||
* Clears all the output from the current line.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function clearLine(): self
|
||||
{
|
||||
@@ -119,6 +154,8 @@ final class Cursor
|
||||
|
||||
/**
|
||||
* Clears all the output from the cursors' current position to the end of the screen.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function clearOutput(): self
|
||||
{
|
||||
@@ -129,6 +166,8 @@ final class Cursor
|
||||
|
||||
/**
|
||||
* Clears the entire screen.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function clearScreen(): self
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user