Controller/AzineEmailTemplateController.php
public function checkSpamScoreOfSentEmailAction(Request $request)
    {
        $msgString = $request->get('emailSource');
        $spamReport = $this->getSpamIndexReport($msgString);
        $spamInfo = '';
        if (is_array($spamReport)) {
            if (array_key_exists('curlHttpCode', $spamReport) && 200 == $spamReport['curlHttpCode'] && $spamReport['success'] && array_key_exists('score', $spamReport)) {
                $spamScore = $spamReport['score'];
                $spamInfo = "SpamScore: $spamScore! \n".$spamReport['report'];
            //@codeCoverageIgnoreStart
                // this only happens if the spam-check-server has a problem / is not responding
            } else {
                if (array_key_exists('curlHttpCode', $spamReport) && array_key_exists('curlError', $spamReport) && array_key_exists('message', $spamReport)) {
                    $spamInfo = 'Getting the spam-info failed.
                    HttpCode: '.$spamReport['curlHttpCode'].'
                    cURL-Error: '.$spamReport['curlError'].'
                    SpamReportMsg: '.$spamReport['message'];
                } elseif (null !== $spamReport && is_array($spamReport)) {
                    $spamInfo = 'Getting the spam-info failed. This was returned:
---Start----------------------------------------------
'.implode(";\n", $spamReport).'
---End------------------------------------------------';
                }
                //@codeCoverageIgnoreEnd
            }
        }

        return new JsonResponse(array('result' => $spamInfo));
    }
public function checkSpamScoreOfSentEmailAction(Request $request)
    {
        $msgString = $request->get('emailSource');
        $spamReport = $this->getSpamIndexReport($msgString);
        $spamInfo = '';
        if (is_array($spamReport)) {
            if (array_key_exists('curlHttpCode', $spamReport) && 200 == $spamReport['curlHttpCode'] && $spamReport['success'] && array_key_exists('score', $spamReport)) {
                $spamScore = $spamReport['score'];
                $spamInfo = "SpamScore: $spamScore! \n".$spamReport['report'];
            //@codeCoverageIgnoreStart
                // this only happens if the spam-check-server has a problem / is not responding
            } else {
                if (array_key_exists('curlHttpCode', $spamReport) && array_key_exists('curlError', $spamReport) && array_key_exists('message', $spamReport)) {
                    $spamInfo = 'Getting the spam-info failed.
                    HttpCode: '.$spamReport['curlHttpCode'].'
                    cURL-Error: '.$spamReport['curlError'].'
                    SpamReportMsg: '.$spamReport['message'];
                } elseif (null !== $spamReport && is_array($spamReport)) {
                    $spamInfo = 'Getting the spam-info failed. This was returned:
---Start----------------------------------------------
'.implode(";\n", $spamReport).'
---End------------------------------------------------';
                }
                //@codeCoverageIgnoreEnd
            }
        }

        return new JsonResponse(array('result' => $spamInfo));
    }
public function checkSpamScoreOfSentEmailAction ( Request $ request ) { $ msgString = $ request -> get ( 'emailSource' ) ; $ spamReport = $ this -> getSpamIndexReport ( $ msgString ) ; $ spamInfo = '' ; if ( is_array ( $ spamReport ) ) { if ( array_key_exists ( 'curlHttpCode' , $ spamReport ) && 200 == $ spamReport [ 'curlHttpCode' ] && $ spamReport [ 'success' ] && array_key_exists ( 'score' , $ spamReport ) ) { $ spamScore = $ spamReport [ 'score' ] ; $ spamInfo = "SpamScore: $spamScore! \n" . $ spamReport [ 'report' ] ; //@codeCoverageIgnoreStart // this only happens if the spam-check-server has a problem / is not responding } else { if ( array_key_exists ( 'curlHttpCode' , $ spamReport ) && array_key_exists ( 'curlError' , $ spamReport ) && array_key_exists ( 'message' , $ spamReport ) ) { $ spamInfo = 'Getting the spam-info failed.
                    HttpCode: ' . $ spamReport [ 'curlHttpCode' ] . '
                    cURL-Error: ' . $ spamReport [ 'curlError' ] . '
                    SpamReportMsg: ' . $ spamReport [ 'message' ] ; } elseif ( null !== $ spamReport && is_array ( $ spamReport ) ) { $ spamInfo = 'Getting the spam-info failed. This was returned:
---Start----------------------------------------------
' . implode ( ";\n" , $ spamReport ) . '
---End------------------------------------------------' ; } //@codeCoverageIgnoreEnd } } return new JsonResponse ( array ( 'result' => $ spamInfo ) ) ; }
Ajax action to check the spam-score for the pasted email-source.
Ajax action to check the spam - score for the pasted email - source .