protected function validateNumber($number) {
    if (!(is_int($number) || is_string($number) && is_numeric($number))) {
      $type = is_object($number) ? get_class($number) : gettype($number);
      throw new \InvalidArgumentException(sprintf('An integer or numeric string was expected, but %s was given.', $type));
    }
  }