1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @ORM\Entity |
9
|
|
|
* @ORM\Table(name="variable_hooks") |
10
|
|
|
*/ |
11
|
|
View Code Duplication |
class VarHook |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @ORM\Column(type="integer") |
16
|
|
|
* @ORM\Id |
17
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
18
|
|
|
*/ |
19
|
|
|
private $id; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @ORM\Column(type="string", length=100) |
23
|
|
|
*/ |
24
|
|
|
private $name; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @return mixed |
28
|
|
|
*/ |
29
|
|
|
public function getType() |
30
|
|
|
{ |
31
|
|
|
return $this->type; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param mixed $type |
36
|
|
|
* @return VarHook |
37
|
|
|
*/ |
38
|
1 |
|
public function setType($type) |
39
|
|
|
{ |
40
|
1 |
|
$this->type = $type; |
41
|
1 |
|
return $this; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return mixed |
46
|
|
|
*/ |
47
|
|
|
public function getExecutor() |
48
|
|
|
{ |
49
|
|
|
return $this->executor; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param mixed $executor |
54
|
|
|
* @return VarHook |
55
|
|
|
*/ |
56
|
1 |
|
public function setExecutor($executor) |
57
|
|
|
{ |
58
|
1 |
|
$this->executor = $executor; |
59
|
1 |
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @ORM\Column(type="string", length=20) |
64
|
|
|
*/ |
65
|
|
|
private $type; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @ORM\Column(type="string", length=100) |
69
|
|
|
*/ |
70
|
|
|
private $executor; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @ORM\ManyToOne(inversedBy="widgets",targetEntity="AppBundle\Entity\Variable") |
74
|
|
|
*/ |
75
|
|
|
private $variable; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @ORM\ManyToOne(inversedBy="hooks",targetEntity="AppBundle\Entity\Action") |
79
|
|
|
*/ |
80
|
|
|
private $action; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return mixed |
84
|
|
|
*/ |
85
|
|
|
public function getArguments() |
86
|
|
|
{ |
87
|
|
|
return $this->arguments; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param mixed $arguments |
92
|
|
|
* @return VarHook |
93
|
|
|
*/ |
94
|
1 |
|
public function setArguments($arguments) |
95
|
|
|
{ |
96
|
1 |
|
$this->arguments = $arguments; |
97
|
1 |
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @ORM\Column(type="text") |
102
|
|
|
*/ |
103
|
|
|
private $arguments; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return Variable |
107
|
|
|
*/ |
108
|
|
|
public function getVariable() |
109
|
|
|
{ |
110
|
|
|
return $this->variable; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param mixed $variable |
115
|
|
|
* @return VarHook |
116
|
|
|
*/ |
117
|
1 |
|
public function setVariable($variable) |
118
|
|
|
{ |
119
|
1 |
|
$this->variable = $variable; |
120
|
1 |
|
return $this; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return mixed |
125
|
|
|
*/ |
126
|
|
|
public function getId() |
127
|
|
|
{ |
128
|
|
|
return $this->id; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @param mixed $id |
133
|
|
|
* @return VarHook |
134
|
|
|
*/ |
135
|
|
|
public function setId($id) |
136
|
|
|
{ |
137
|
|
|
$this->id = $id; |
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @return mixed |
143
|
|
|
*/ |
144
|
|
|
public function getName() |
145
|
|
|
{ |
146
|
|
|
return $this->name; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @param mixed $name |
151
|
|
|
* @return VarHook |
152
|
|
|
*/ |
153
|
1 |
|
public function setName($name) |
154
|
|
|
{ |
155
|
1 |
|
$this->name = $name; |
156
|
1 |
|
return $this; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @return mixed |
161
|
|
|
*/ |
162
|
|
|
public function getAction() |
163
|
|
|
{ |
164
|
|
|
return $this->action; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @param mixed $action |
169
|
|
|
* @return VarHook |
170
|
|
|
*/ |
171
|
1 |
|
public function setAction($action) |
172
|
|
|
{ |
173
|
1 |
|
$this->action = $action; |
174
|
1 |
|
return $this; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
|
178
|
|
|
public function __toString() |
179
|
|
|
{ |
180
|
|
|
return $this->getName(); |
181
|
|
|
} |
182
|
|
|
} |
183
|
|
|
|
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.