Completed
Push — master ( bd4cbc...df0c76 )
by Arnaud
9s
created

BeforeConfigurationEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 63
loc 63
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getAdmin() 4 4 1
A getActionName() 4 4 1
A getActionConfiguration() 4 4 1
A setActionConfiguration() 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 LAG\AdminBundle\Action\Event;
4
5
use LAG\AdminBundle\Admin\AdminInterface;
6
use Symfony\Component\EventDispatcher\Event;
7
8
/**
9
 * Event dispatch before the creation of an action to allow third-party modification
10
 */
11 View Code Duplication
class BeforeConfigurationEvent extends Event
12
{
13
    /**
14
     * @var AdminInterface
15
     */
16
    protected $admin;
17
18
    /**
19
     * @var string
20
     */
21
    protected $actionName;
22
23
    /**
24
     * @var array
25
     */
26
    protected $actionConfiguration;
27
28
    /**
29
     * BeforeConfigurationEvent constructor.
30
     *
31
     * @param $actionName
32
     * @param $actionConfiguration
33
     * @param AdminInterface $admin
34
     */
35 5
    public function __construct($actionName, $actionConfiguration, AdminInterface $admin)
36
    {
37 5
        $this->actionName = $actionName;
38 5
        $this->actionConfiguration = $actionConfiguration;
39 5
        $this->admin = $admin;
40 5
    }
41
42
    /**
43
     * @return AdminInterface
44
     */
45 2
    public function getAdmin()
46
    {
47 2
        return $this->admin;
48
    }
49
50
    /**
51
     * @return string
52
     */
53 2
    public function getActionName()
54
    {
55 2
        return $this->actionName;
56
    }
57
58
    /**
59
     * @return array
60
     */
61 5
    public function getActionConfiguration()
62
    {
63 5
        return $this->actionConfiguration;
64
    }
65
66
    /**
67
     * @param array $actionConfiguration
68
     */
69 2
    public function setActionConfiguration($actionConfiguration)
70
    {
71 2
        $this->actionConfiguration = $actionConfiguration;
72 2
    }
73
}
74