code: public function validate(string $answer): string {
      if(trim((string) $answer) === '') {
        throw new \RuntimeException(sprintf('%s Given value: "%s"', $this->getErrorMessage(), $answer));
      }
      return $answer;
    }
docs: Checks if the trimmed answer is an empty string. If so, a \RuntimeException with the error message and the value is thrown.
  
  @param string $answer The answer to be validated
  @return string The validated answer
  @throws \RuntimeException if the answer is empty