1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27:
<?php
/**
* Cz CLI Console
* @author Jan Pecha, <janpecha@email.cz>
*/
namespace Cz\Cli\Inputs;
use Cz\Cli\IInputProvider;
class DefaultInputProvider implements IInputProvider
{
public function readInput()
{
// see http://www.php-trivandrum.org/code-snippets/user-input-in-php-command-line/
// see http://wiki.uniformserver.com/index.php/PHP_CLI:_User_Input#fgets.28.29_-_Problem
return trim(fgets(STDIN));
}
public function isPrintingPrompt()
{
return FALSE;
}
}