CommentSpamProtection::alterCommentForm()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace SilverStripe\SpamProtection\Extension;
4
5
use SilverStripe\Core\Extension;
6
7
/**
8
 * Apply the spam protection to the comments module if it is installed.
9
 *
10
 * @package spamprotection
11
 */
12
13
class CommentSpamProtection extends Extension
14
{
15
    public function alterCommentForm(&$form)
16
    {
17
        $form->enableSpamProtection(array(
18
            'name' => 'IsSpam',
19
            'mapping' => array(
20
                'Name' => 'authorName',
21
                'Email' => 'authorEmail',
22
                'URL' => 'authorUrl',
23
                'Comment' => 'body',
24
                'ReturnURL' => 'contextUrl'
25
            ),
26
            'checks' => array(
27
                'spam',
28
                'profanity'
29
            )
30
        ));
31
    }
32
}
33