code: private function filterString($str): string
      {
          if (is_string($str) && strlen($str) > 0 && $str !== null) {
              return $str;
          }
          throw new \Exception('String required', 1);
      }
docs: Make sure string is not null or empty
  @param   mixed $str
  @return string if it is valid or exception
  @throws \Exception