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\Cerbere; |
26
|
|
|
use Cerbere\Model\Job; |
27
|
|
|
use Cerbere\Model\Project; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class CerberePostActionEvent |
31
|
|
|
* @package Cerbere\Event |
32
|
|
|
*/ |
33
|
|
View Code Duplication |
class CerberePostActionEvent extends CerbereEvent |
|
|
|
|
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* @var Cerbere |
37
|
|
|
*/ |
38
|
|
|
protected $cerbere; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var Job |
42
|
|
|
*/ |
43
|
|
|
protected $job; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var ActionInterface |
47
|
|
|
*/ |
48
|
|
|
protected $action; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var Project[] |
52
|
|
|
*/ |
53
|
|
|
protected $projects; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param Cerbere $cerbere |
57
|
|
|
* @param Job $job |
58
|
|
|
* @param ActionInterface $action |
59
|
|
|
* @param Project[] $projects |
60
|
|
|
*/ |
61
|
|
|
public function __construct(Cerbere $cerbere, Job $job, ActionInterface $action, $projects = array()) |
62
|
|
|
{ |
63
|
|
|
$this->cerbere = $cerbere; |
64
|
|
|
$this->job = $job; |
65
|
|
|
$this->action = $action; |
66
|
|
|
$this->projects = $projects; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return ActionInterface |
71
|
|
|
*/ |
72
|
|
|
public function getAction() |
73
|
|
|
{ |
74
|
|
|
return $this->action; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param ActionInterface $action |
79
|
|
|
*/ |
80
|
|
|
public function setAction($action) |
81
|
|
|
{ |
82
|
|
|
$this->action = $action; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return Cerbere |
87
|
|
|
*/ |
88
|
|
|
public function getCerbere() |
89
|
|
|
{ |
90
|
|
|
return $this->cerbere; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @return Job |
95
|
|
|
*/ |
96
|
|
|
public function getJob() |
97
|
|
|
{ |
98
|
|
|
return $this->job; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @param Job $job |
103
|
|
|
*/ |
104
|
|
|
public function setJob($job) |
105
|
|
|
{ |
106
|
|
|
$this->job = $job; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return Project[] |
111
|
|
|
*/ |
112
|
|
|
public function getProjects() |
113
|
|
|
{ |
114
|
|
|
return $this->projects; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param Project[] $projects |
119
|
|
|
*/ |
120
|
|
|
public function setProjects($projects) |
121
|
|
|
{ |
122
|
|
|
$this->projects = $projects; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|
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.