code: public static function isValidFormat($format, $throw = false)
      {
          if (in_array($format, static::getFormats(), true)) {
              return true;
          }
  
          if ($throw) {
              throw new InvalidArgumentException("Unknown format '$format'.");
          }
  
          return false;
      }
docs: Returns whether the given format is valid.
  
  @param string $format
  @param bool   $throw
  
  @return bool