public function create() { $that = $this; //todo: speed variable $this->loop->addReadStream(STDIN, function ($stdin) use($that) { $input = trim(fgets($stdin)); if (in_array($input, Config::$commands)) { if ($input === 'exit') { exit; } else { $that->emit('action', [$input]); } } else { echo 'Unknown command' . PHP_EOL; } echo $that->prompt; }); echo $this->getAsciiArt(); echo PHP_EOL; echo $this->prompt; }