Completed
Push — refonte ( 731c5f...9f4593 )
by Arnaud
22:08 queued 19:48
created

ViewEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A getView() 4 4 1
A setView() 4 4 1
A getAdmin() 4 4 1
A getRequest() 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\Event\Events;
4
5
use LAG\AdminBundle\Admin\AdminInterface;
6
use LAG\AdminBundle\View\ViewInterface;
7
use Symfony\Component\EventDispatcher\Event;
8
use Symfony\Component\HttpFoundation\Request;
9
10 View Code Duplication
class ViewEvent extends Event
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...
11
{
12
    /**
13
     * @var ViewInterface
14
     */
15
    private $view;
16
17
    /**
18
     * @var AdminInterface
19
     */
20
    private $admin;
21
22
    /**
23
     * @var Request
24
     */
25
    private $request;
26
27
    /**
28
     * ViewEvent constructor.
29
     *
30
     * @param AdminInterface $admin
31
     * @param Request        $request
32
     */
33
    public function __construct(AdminInterface $admin, Request $request)
0 ignored issues
show
Bug introduced by
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
34
    {
35
        $this->admin = $admin;
36
        $this->request = $request;
37
    }
38
39
    /**
40
     * @return ViewInterface
41
     */
42
    public function getView(): ViewInterface
43
    {
44
        return $this->view;
45
    }
46
47
    /**
48
     * @param ViewInterface $view
49
     */
50
    public function setView(ViewInterface $view)
51
    {
52
        $this->view = $view;
53
    }
54
55
    /**
56
     * @return AdminInterface
57
     */
58
    public function getAdmin(): AdminInterface
59
    {
60
        return $this->admin;
61
    }
62
63
    /**
64
     * @return Request
65
     */
66
    public function getRequest(): Request
67
    {
68
        return $this->request;
69
    }
70
}
71