public static function isValidProtocolVersion($version)
    {
        if (!is_string($version) || empty($version)) {
            return false;
        }

        return (bool) preg_match('#^(1\.[01]|2)$#', $version);
    }
public static function isValidProtocolVersion($version)
    {
        if (!is_string($version) || empty($version)) {
            return false;
        }

        return (bool) preg_match('#^(1\.[01]|2)$#', $version);
    }
public static function isValidProtocolVersion ( $ version ) { if ( ! is_string ( $ version ) || empty ( $ version ) ) { return false ; } return ( bool ) preg_match ( '#^(1\.[01]|2)$#' , $ version ) ; }
Method to validate protocol version format.

Only allow 1.0, 1.1 and 2.

@param   string $version Version string to validate.

@return  boolean  Valid or not.
Method to validate protocol version format .