1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Webino (http://webino.sk) |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/webino/WebinoDraw for the canonical source repository |
6
|
|
|
* @copyright Copyright (c) 2012-2017 Webino, s. r. o. (http://webino.sk) |
7
|
|
|
* @author Peter Bačinský <[email protected]> |
8
|
|
|
* @license BSD-3-Clause |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace WebinoDraw\Manipulator\Plugin; |
12
|
|
|
|
13
|
|
|
use WebinoDraw\Dom\NodeInterface; |
14
|
|
|
use WebinoDraw\Dom\NodeList; |
15
|
|
|
use WebinoDraw\Draw\Helper\HelperInterface; |
16
|
|
|
use WebinoDraw\VarTranslator\Translation; |
17
|
|
|
use Zend\Stdlib\AbstractOptions; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* |
21
|
|
|
*/ |
22
|
|
|
class PluginArgument extends AbstractOptions |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var HelperInterface |
26
|
|
|
*/ |
27
|
|
|
protected $helper; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var NodeInterface |
31
|
|
|
*/ |
32
|
|
|
protected $node; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var NodeList |
36
|
|
|
*/ |
37
|
|
|
protected $nodes; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var array |
41
|
|
|
*/ |
42
|
|
|
protected $spec = []; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var Translation |
46
|
|
|
*/ |
47
|
|
|
protected $translation; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var Translation |
51
|
|
|
*/ |
52
|
|
|
protected $varTranslation; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var bool |
56
|
|
|
*/ |
57
|
|
|
protected $stopManipulation = false; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return HelperInterface |
61
|
|
|
*/ |
62
|
|
|
public function getHelper() |
63
|
|
|
{ |
64
|
|
|
return $this->helper; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param HelperInterface $helper |
69
|
|
|
* @return self |
70
|
|
|
*/ |
71
|
|
|
public function setHelper(HelperInterface $helper) |
72
|
|
|
{ |
73
|
|
|
$this->helper = $helper; |
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return NodeInterface |
79
|
|
|
*/ |
80
|
|
|
public function getNode() |
81
|
|
|
{ |
82
|
|
|
return $this->node; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @param NodeInterface $node |
87
|
|
|
* @return self |
88
|
|
|
*/ |
89
|
|
|
public function setNode(NodeInterface $node) |
90
|
|
|
{ |
91
|
|
|
$this->node = $node; |
92
|
|
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return NodeList |
97
|
|
|
*/ |
98
|
|
|
public function getNodes() |
99
|
|
|
{ |
100
|
|
|
return $this->nodes; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @param NodeList $nodes |
105
|
|
|
* @return self |
106
|
|
|
*/ |
107
|
|
|
public function setNodes(NodeList $nodes) |
108
|
|
|
{ |
109
|
|
|
$this->nodes = $nodes; |
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @return array |
115
|
|
|
*/ |
116
|
|
|
public function getSpec() |
117
|
|
|
{ |
118
|
|
|
return $this->spec; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param array $spec |
123
|
|
|
* @return self |
124
|
|
|
*/ |
125
|
|
|
public function setSpec(array $spec) |
126
|
|
|
{ |
127
|
|
|
$this->spec = $spec; |
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @return Translation |
133
|
|
|
*/ |
134
|
|
|
public function getTranslation() |
135
|
|
|
{ |
136
|
|
|
return $this->translation; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param Translation $translation |
141
|
|
|
* @return self |
142
|
|
|
*/ |
143
|
|
|
public function setTranslation(Translation $translation) |
144
|
|
|
{ |
145
|
|
|
$this->translation = $translation; |
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return Translation |
151
|
|
|
*/ |
152
|
|
|
public function getVarTranslation() |
153
|
|
|
{ |
154
|
|
|
return $this->varTranslation; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @param Translation $varTranslation |
159
|
|
|
* @return self |
160
|
|
|
*/ |
161
|
|
|
public function setVarTranslation(Translation $varTranslation) |
162
|
|
|
{ |
163
|
|
|
$this->varTranslation = $varTranslation; |
164
|
|
|
return $this; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @return bool |
169
|
|
|
*/ |
170
|
|
|
public function isManipulationStopped() |
171
|
|
|
{ |
172
|
|
|
return $this->stopManipulation; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @param bool $flag |
177
|
|
|
* @return self |
178
|
|
|
*/ |
179
|
|
|
public function stopManipulation($flag = true) |
180
|
|
|
{ |
181
|
|
|
$this->stopManipulation = (bool) $flag; |
182
|
|
|
return $this; |
183
|
|
|
} |
184
|
|
|
} |
185
|
|
|
|