Skip to content

Commit

Permalink
Added ReaderInterface::readCharacter() method
Browse files Browse the repository at this point in the history
  • Loading branch information
freost committed Nov 3, 2024
1 parent 30f2ce2 commit 585943d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mako/cli/input/reader/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ public function read(): string
{
return trim(fgets(STDIN));
}

/**
* {@inheritDoc}
*/
public function readCharacter(): string
{
return fgetc(STDIN);
}
}
5 changes: 5 additions & 0 deletions src/mako/cli/input/reader/ReaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ interface ReaderInterface
* Reads and returns user input.
*/
public function read(): string;

/**
* Reads and returns a single character.
*/
public function readCharacter(): string;
}

0 comments on commit 585943d

Please sign in to comment.