summaryrefslogtreecommitdiff
path: root/tests/simple_unit/SqlMap/gen.php
blob: 40ddc2979c4a14073070926ffb0c92640ceed460 (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
<?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";
	}
}