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 AdminInterface
14
*/
15
private $admin;
16
17
/**
18
* @var ActionInterface
19
*/
20
private $action;
21
22
/**
23
* @var Request
24
*/
25
private $request;
26
27
/**
28
* AdminEvent constructor.
29
*
30
* @param AdminInterface $admin
31
* @param Request $request
32
*/
33
public function __construct(AdminInterface $admin, Request $request)
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 AdminInterface
41
*/
42
public function getAdmin(): AdminInterface
43
{
44
return $this->admin;
45
}
46
47
/**
48
* @return ActionInterface
49
*/
50
public function getAction(): ActionInterface
51
{
52
return $this->action;
53
}
54
55
/**
56
* @return bool
57
*/
58
public function hasAction(): bool
59
{
60
return null !== $this->action;
61
}
62
63
/**
64
* @param ActionInterface $action
65
*/
66
public function setAction(ActionInterface $action)
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.