1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Drush Cerbere command line tools. |
5
|
|
|
* Copyright (C) 2015 - Sebastien Malot <[email protected]> |
6
|
|
|
* |
7
|
|
|
* This program is free software; you can redistribute it and/or modify |
8
|
|
|
* it under the terms of the GNU General Public License as published by |
9
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
10
|
|
|
* (at your option) any later version. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU General Public License along |
18
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc., |
19
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Cerbere\Event; |
23
|
|
|
|
24
|
|
|
use Cerbere\Action\ActionInterface; |
25
|
|
|
use Cerbere\Model\Project; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Class CerbereDoActionEvent |
29
|
|
|
* @package Cerbere\Event |
30
|
|
|
*/ |
31
|
|
View Code Duplication |
class CerbereDoActionEvent extends CerbereEvent |
|
|
|
|
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @var ActionInterface |
35
|
|
|
*/ |
36
|
|
|
protected $action; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var Project |
40
|
|
|
*/ |
41
|
|
|
protected $project; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param ActionInterface $action |
45
|
|
|
* @param Project $project |
46
|
|
|
*/ |
47
|
|
|
public function __construct(ActionInterface $action, Project $project) |
48
|
|
|
{ |
49
|
|
|
$this->action = $action; |
50
|
|
|
$this->project = $project; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return ActionInterface |
55
|
|
|
*/ |
56
|
|
|
public function getAction() |
57
|
|
|
{ |
58
|
|
|
return $this->action; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param ActionInterface $action |
63
|
|
|
*/ |
64
|
|
|
public function setAction($action) |
65
|
|
|
{ |
66
|
|
|
$this->action = $action; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return Project |
71
|
|
|
*/ |
72
|
|
|
public function getProject() |
73
|
|
|
{ |
74
|
|
|
return $this->project; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param Project $project |
79
|
|
|
*/ |
80
|
|
|
public function setProject($project) |
81
|
|
|
{ |
82
|
|
|
$this->project = $project; |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|
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.