Completed
Push — master ( 5f8d2a...42c733 )
by Franco
11s
created

CommentSpamProtection   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A alterCommentForm() 0 17 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