blob: 855172bab00f52f7e020056d84c4bf1bd52ca911 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
$props = <<<EOD
_prepend
_property
_compareProperty
_compareValue
EOD;
print_vars($props);
echo "\n";
print_funcs($props);
function print_vars($props)
{
foreach(explode("\n", $props) as $prop)
{
echo "\tprivate \${$prop};\n";
}
}
function print_funcs($props)
{
foreach(explode("\n", $props) as $prop)
{
$name = ucfirst(str_replace('_', '', $prop));
$getter = "\tpublic function get{$name}(){ return \$this->{$prop}; }\n";
$setter = "\tpublic function set{$name}(\$value){ \$this->{$prop} = \$value; }\n";
echo $getter.$setter."\n";
}
}
?>
|