|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
14
|
|
|
* |
|
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
|
16
|
|
|
* and is licensed under the LGPL. For more information please see |
|
17
|
|
|
* <http://phing.info>. |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* A parameter is composed of a name, type and value. Nested |
|
22
|
|
|
* Parameters are also possible, but the using task/type has |
|
23
|
|
|
* to support them |
|
24
|
|
|
* |
|
25
|
|
|
* @author Manuel Holtgrewe |
|
26
|
|
|
* @author <a href="mailto:[email protected]">Yannick Lecaillez</a> |
|
27
|
|
|
* @package phing.types |
|
28
|
|
|
*/ |
|
29
|
|
|
class Parameter extends DataType |
|
30
|
|
|
{ |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Parameter name |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $name; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Parameter type |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $type; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Parameter value |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $value; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Nested parameters |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $parameters = []; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @param $name |
|
54
|
|
|
*/ |
|
55
|
9 |
|
public function setName($name) |
|
56
|
|
|
{ |
|
57
|
9 |
|
$this->name = (string) $name; |
|
58
|
9 |
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param $type |
|
62
|
|
|
*/ |
|
63
|
6 |
|
public function setType($type) |
|
64
|
|
|
{ |
|
65
|
6 |
|
$this->type = (string) $type; |
|
66
|
6 |
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Sets value to dynamic register slot. |
|
70
|
|
|
* |
|
71
|
|
|
* @param RegisterSlot $value |
|
72
|
|
|
*/ |
|
73
|
1 |
|
public function setListeningValue(RegisterSlot $value) |
|
74
|
|
|
{ |
|
75
|
1 |
|
$this->value = $value; |
|
76
|
1 |
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @param $value |
|
80
|
|
|
*/ |
|
81
|
14 |
|
public function setValue($value) |
|
82
|
|
|
{ |
|
83
|
14 |
|
$this->value = (string) $value; |
|
84
|
14 |
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @param $v |
|
88
|
|
|
*/ |
|
89
|
|
|
public function addText($v) |
|
90
|
|
|
{ |
|
91
|
|
|
$this->value = $v; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
9 |
|
public function getName() |
|
95
|
|
|
{ |
|
96
|
9 |
|
return $this->name; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
6 |
|
public function getType() |
|
100
|
|
|
{ |
|
101
|
6 |
|
return $this->type; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return mixed |
|
106
|
|
|
*/ |
|
107
|
15 |
|
public function getValue() |
|
108
|
|
|
{ |
|
109
|
15 |
|
if ($this->value instanceof RegisterSlot) { |
|
110
|
1 |
|
return $this->value->getValue(); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
14 |
|
return $this->value; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @return Parameter |
|
118
|
|
|
*/ |
|
119
|
1 |
|
public function createParam() |
|
120
|
|
|
{ |
|
121
|
1 |
|
$num = array_push($this->parameters, new Parameter()); |
|
122
|
|
|
|
|
123
|
1 |
|
return $this->parameters[$num - 1]; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @return array Nested parameters. |
|
128
|
|
|
*/ |
|
129
|
2 |
|
public function getParams() |
|
130
|
|
|
{ |
|
131
|
2 |
|
return $this->parameters; |
|
132
|
|
|
} |
|
133
|
|
|
} |
|
134
|
|
|
|