protected function createSwiftSigner($signature)
    {
        if (!isset($signature['type'])) {
            throw new InvalidConfigException('Signature configuration should contain "type" key');
        }
        switch (strtolower($signature['type'])) {
            case 'dkim' :
                $domain = ArrayHelper::getValue($signature, 'domain', null);
                $selector = ArrayHelper::getValue($signature, 'selector', null);
                if (isset($signature['key'])) {
                    $privateKey = $signature['key'];
                } elseif (isset($signature['file'])) {
                    $privateKey = file_get_contents(Yii::getAlias($signature['file']));
                } else {
                    throw new InvalidConfigException("Either 'key' or 'file' signature option should be specified");
                }
                return new \Swift_Signers_DKIMSigner($privateKey, $domain, $selector);
            case 'opendkim' :
                $domain = ArrayHelper::getValue($signature, 'domain', null);
                $selector = ArrayHelper::getValue($signature, 'selector', null);
                if (isset($signature['key'])) {
                    $privateKey = $signature['key'];
                } elseif (isset($signature['file'])) {
                    $privateKey = file_get_contents(Yii::getAlias($signature['file']));
                } else {
                    throw new InvalidConfigException("Either 'key' or 'file' signature option should be specified");
                }
                return new \Swift_Signers_OpenDKIMSigner($privateKey, $domain, $selector);
            default:
                throw new InvalidConfigException("Unrecognized signature type '{$signature['type']}'");
        }
    }
protected function createSwiftSigner($signature)
    {
        if (!isset($signature['type'])) {
            throw new InvalidConfigException('Signature configuration should contain "type" key');
        }
        switch (strtolower($signature['type'])) {
            case 'dkim' :
                $domain = ArrayHelper::getValue($signature, 'domain', null);
                $selector = ArrayHelper::getValue($signature, 'selector', null);
                if (isset($signature['key'])) {
                    $privateKey = $signature['key'];
                } elseif (isset($signature['file'])) {
                    $privateKey = file_get_contents(Yii::getAlias($signature['file']));
                } else {
                    throw new InvalidConfigException("Either 'key' or 'file' signature option should be specified");
                }
                return new \Swift_Signers_DKIMSigner($privateKey, $domain, $selector);
            case 'opendkim' :
                $domain = ArrayHelper::getValue($signature, 'domain', null);
                $selector = ArrayHelper::getValue($signature, 'selector', null);
                if (isset($signature['key'])) {
                    $privateKey = $signature['key'];
                } elseif (isset($signature['file'])) {
                    $privateKey = file_get_contents(Yii::getAlias($signature['file']));
                } else {
                    throw new InvalidConfigException("Either 'key' or 'file' signature option should be specified");
                }
                return new \Swift_Signers_OpenDKIMSigner($privateKey, $domain, $selector);
            default:
                throw new InvalidConfigException("Unrecognized signature type '{$signature['type']}'");
        }
    }
protected function createSwiftSigner ( $ signature ) { if ( ! isset ( $ signature [ 'type' ] ) ) { throw new InvalidConfigException ( 'Signature configuration should contain "type" key' ) ; } switch ( strtolower ( $ signature [ 'type' ] ) ) { case 'dkim' : $ domain = ArrayHelper :: getValue ( $ signature , 'domain' , null ) ; $ selector = ArrayHelper :: getValue ( $ signature , 'selector' , null ) ; if ( isset ( $ signature [ 'key' ] ) ) { $ privateKey = $ signature [ 'key' ] ; } elseif ( isset ( $ signature [ 'file' ] ) ) { $ privateKey = file_get_contents ( Yii :: getAlias ( $ signature [ 'file' ] ) ) ; } else { throw new InvalidConfigException ( "Either 'key' or 'file' signature option should be specified" ) ; } return new \ Swift_Signers_DKIMSigner ( $ privateKey , $ domain , $ selector ) ; case 'opendkim' : $ domain = ArrayHelper :: getValue ( $ signature , 'domain' , null ) ; $ selector = ArrayHelper :: getValue ( $ signature , 'selector' , null ) ; if ( isset ( $ signature [ 'key' ] ) ) { $ privateKey = $ signature [ 'key' ] ; } elseif ( isset ( $ signature [ 'file' ] ) ) { $ privateKey = file_get_contents ( Yii :: getAlias ( $ signature [ 'file' ] ) ) ; } else { throw new InvalidConfigException ( "Either 'key' or 'file' signature option should be specified" ) ; } return new \ Swift_Signers_OpenDKIMSigner ( $ privateKey , $ domain , $ selector ) ; default : throw new InvalidConfigException ( "Unrecognized signature type '{$signature['type']}'" ) ; } }
Creates signer from its configuration
@param array $signature signature configuration
@return \Swift_Signer signer instance
@throws InvalidConfigException on invalid configuration provided
@since 2.0.6
Creates signer from its configuration