Completed
Push — master ( 06c1ce...67d37c )
by Jeroen
06:20
created

LocaleBlacklistRule   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 71
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 71
loc 71
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getLocale() 4 4 1
A setLocale() 6 6 1
A getJsObjectClass() 4 4 1
A getJsProperties() 6 6 1
A getService() 4 4 1
A getJsFilePath() 4 4 1
A getAdminType() 4 4 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
namespace Kunstmaan\LeadGenerationBundle\Entity\Rule;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Kunstmaan\LeadGenerationBundle\Form\Rule\LocaleBlackListAdminType;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
/**
10
 * @ORM\Entity
11
 * @ORM\Table(name="kuma_rule_locale_blacklist")
12
 */
13 View Code Duplication
class LocaleBlacklistRule extends AbstractRule
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...
14
{
15
    /**
16
     * @var string
17
     * @ORM\Column(name="locale", type="text", nullable=true)
18
     * @Assert\NotBlank()
19
     */
20
    private $locale;
21
22
    /**
23
     * @return string
24
     */
25 1
    public function getLocale()
26
    {
27 1
        return $this->locale;
28
    }
29
30
    /**
31
     * @param string $locale
32
     *
33
     * @return LocaleWhitelistRule
0 ignored issues
show
Documentation introduced by
Should the return type not be LocaleBlacklistRule?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
34
     */
35 1
    public function setLocale($locale)
36
    {
37 1
        $this->locale = $locale;
38
39 1
        return $this;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 1
    public function getJsObjectClass()
46
    {
47 1
        return 'LocaleBlacklistRule';
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53 1
    public function getJsProperties()
54
    {
55
        return array(
56 1
            'locale' => $this->getLocale(),
57
        );
58
    }
59
60
    /**
61
     * @return string
62
     */
63 1
    public function getService()
64
    {
65 1
        return 'kunstmaan_lead_generation.rule.service.localeruleservice';
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71 1
    public function getJsFilePath()
72
    {
73 1
        return '/bundles/kunstmaanleadgeneration/js/rule/LocaleBlacklistRule.js';
74
    }
75
76
    /**
77
     * @return string
78
     */
79 1
    public function getAdminType()
80
    {
81 1
        return LocaleBlackListAdminType::class;
82
    }
83
}
84