private function getUsersNextMove($handle) { $length = $this->board->getLength(); $width = $this->board->getWidth(); $exampleRow = floor($length / 2); $exampleColumn = floor($width / 2); $examplePoint = $exampleRow . ',' . $exampleColumn; $prompt = 'Enter move in the format "[row],[column]" e.g. "' . $examplePoint . '". To toggle a flag on a cell, prefix with an "f" e.g. "f' . $examplePoint . '"'; $move = null; do { echo $prompt . ': '; $input = rtrim(fgets($handle)); try { $move = Move::parse($input, $length - 1, $width - 1); } catch (InvalidArgumentException $e) { echo "\nInvalid move. Please try again.\n"; } } while ($move === null); return $move; }