EmailSignupBlock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 37
loc 37
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A singular_name() 4 4 1
A plural_name() 4 4 1
A getCMSFields() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3 View Code Duplication
class EmailSignupBlock extends Block
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4
{
5
    /**
6
     * @return string
7
     */
8 12
    public function singular_name()
9
    {
10 12
        return _t('EmailSignupBlock.SINGULARNAME', 'Email Signup Block');
11
    }
12
13
    /**
14
     * @return string
15
     */
16 1
    public function plural_name()
17
    {
18 1
        return _t('EmailSignupBlock.PLURALNAME', 'Email Signup Blocks');
19
    }
20
21
    /**
22
     * @var array
23
     */
24
    private static $db = [
25
        'EmbedCode' => 'HTMLText',
26
    ];
27
28
    /**
29
     * @return FieldList
30
     */
31 1
    public function getCMSFields()
32
    {
33 1
        $fields = parent::getCMSFields();
34
35 1
        $fields->addFieldToTab('Root.Main', TextareaField::create('EmbedCode')->setTitle('Embed code for signup form'));
36
37 1
        return $fields;
38
    }
39
}