public function toStreamContext($serverName = null)
    {
        $sslContext = array(
            'verify_peer'       => (bool) $this->verifyPeer,
            'allow_self_signed' => (bool) $this->allowSelfSigned
        );

        if (null !== $this->caFile) {
            $sslContext['cafile'] = $this->caFile;
        }

        if (null !== $this->ciphers) {
            $sslContext['ciphers'] = $this->ciphers;
        }

        if (null !== $serverName) {
            $sslContext['SNI_enabled'] = true;
            $sslContext[PHP_VERSION_ID < 50600 ? 'SNI_server_name' : 'peer_name'] = $serverName;

            if ($this->verifyPeer) {
                $sslContext[PHP_VERSION_ID < 50600 ? 'CN_match' : 'peer_name'] = $serverName;
            }
        }

        return array('ssl' => $sslContext);
    }
public function toStreamContext($serverName = null)
    {
        $sslContext = array(
            'verify_peer'       => (bool) $this->verifyPeer,
            'allow_self_signed' => (bool) $this->allowSelfSigned
        );

        if (null !== $this->caFile) {
            $sslContext['cafile'] = $this->caFile;
        }

        if (null !== $this->ciphers) {
            $sslContext['ciphers'] = $this->ciphers;
        }

        if (null !== $serverName) {
            $sslContext['SNI_enabled'] = true;
            $sslContext[PHP_VERSION_ID < 50600 ? 'SNI_server_name' : 'peer_name'] = $serverName;

            if ($this->verifyPeer) {
                $sslContext[PHP_VERSION_ID < 50600 ? 'CN_match' : 'peer_name'] = $serverName;
            }
        }

        return array('ssl' => $sslContext);
    }
public function toStreamContext ( $ serverName = null ) { $ sslContext = array ( 'verify_peer' => ( bool ) $ this -> verifyPeer , 'allow_self_signed' => ( bool ) $ this -> allowSelfSigned ) ; if ( null !== $ this -> caFile ) { $ sslContext [ 'cafile' ] = $ this -> caFile ; } if ( null !== $ this -> ciphers ) { $ sslContext [ 'ciphers' ] = $ this -> ciphers ; } if ( null !== $ serverName ) { $ sslContext [ 'SNI_enabled' ] = true ; $ sslContext [ PHP_VERSION_ID < 50600 ? 'SNI_server_name' : 'peer_name' ] = $ serverName ; if ( $ this -> verifyPeer ) { $ sslContext [ PHP_VERSION_ID < 50600 ? 'CN_match' : 'peer_name' ] = $ serverName ; } } return array ( 'ssl' => $ sslContext ) ; }
Returns a stream-context representation of this config

@param string|null $serverName
@return array<string,mixed>
Returns a stream - context representation of this config