public function withSecurityLevel(int $level): self
    {
        // See https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_security_level.html
        // Level 2 is not recommended, because of SHA-1 by that document,
        // but SHA-1 should be phased out now on general internet use.
        // We therefore default to level 2.

        if ($level < 0 || $level > 5) {
            throw new \Error("Invalid security level ({$level}), must be between 0 and 5.");
        }

        if (\OPENSSL_VERSION_NUMBER < 0x10100000) {
            throw new \Error("Can't set a security level, as PHP is compiled with OpenSSL < 1.1.0.");
        }

        $clone = clone $this;
        $clone->securityLevel = $level;

        return $clone;
    }
public function withSecurityLevel(int $level): self
    {
        // See https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_security_level.html
        // Level 2 is not recommended, because of SHA-1 by that document,
        // but SHA-1 should be phased out now on general internet use.
        // We therefore default to level 2.

        if ($level < 0 || $level > 5) {
            throw new \Error("Invalid security level ({$level}), must be between 0 and 5.");
        }

        if (\OPENSSL_VERSION_NUMBER < 0x10100000) {
            throw new \Error("Can't set a security level, as PHP is compiled with OpenSSL < 1.1.0.");
        }

        $clone = clone $this;
        $clone->securityLevel = $level;

        return $clone;
    }
public function withSecurityLevel ( int $ level ) : self { // See https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_security_level.html // Level 2 is not recommended, because of SHA-1 by that document, // but SHA-1 should be phased out now on general internet use. // We therefore default to level 2. if ( $ level < 0 || $ level > 5 ) { throw new \ Error ( "Invalid security level ({$level}), must be between 0 and 5." ) ; } if ( \ OPENSSL_VERSION_NUMBER < 0x10100000 ) { throw new \ Error ( "Can't set a security level, as PHP is compiled with OpenSSL < 1.1.0." ) ; } $ clone = clone $ this ; $ clone -> securityLevel = $ level ; return $ clone ; }
Security level to use.

Requires OpenSSL 1.1.0 or higher.

@param int $level Must be between 0 and 5.

@return self Cloned, modified instance.
Security level to use .