| 3 |
// $Id$ |
// $Id$ |
| 4 |
// --------------------------------------------------------------------------- |
// --------------------------------------------------------------------------- |
| 5 |
// $Log$ |
// $Log$ |
| 6 |
|
// Revision 1.6 2003/02/28 04:18:13 joko |
| 7 |
|
// + special-case-handling for single argument pass-in |
| 8 |
|
// + testing with constructor autocalling: not used for now since weird sideeffects occoured! |
| 9 |
|
// o however: rethink it completely! |
| 10 |
|
// |
| 11 |
// Revision 1.5 2003/02/27 16:36:02 joko |
// Revision 1.5 2003/02/27 16:36:02 joko |
| 12 |
// re-allowed underscores ('_') in php classnames |
// re-allowed underscores ('_') in php classnames |
| 13 |
// does this break something? |
// does this break something? |
| 44 |
|
|
| 45 |
function mkObject() { |
function mkObject() { |
| 46 |
$arg_list = func_get_args(); |
$arg_list = func_get_args(); |
| 47 |
|
|
| 48 |
|
// patch arglist if all arguments are passed in as a single array |
| 49 |
|
if (count($arg_list) == 1 && is_array($arg_list[0])) { |
| 50 |
|
$arg_list = $arg_list[0]; |
| 51 |
|
} |
| 52 |
|
|
| 53 |
//print Dumper($arg_list); |
//print Dumper($arg_list); |
| 54 |
$namespacedClassname = array_shift($arg_list); |
$namespacedClassname = array_shift($arg_list); |
| 55 |
if (strstr($namespacedClassname, '_')) { |
if (strstr($namespacedClassname, '_')) { |
| 64 |
$classname = str_replace('/', '_', $classname); |
$classname = str_replace('/', '_', $classname); |
| 65 |
} |
} |
| 66 |
$obj = new DesignPattern_Bridge($classname, $attributes); |
$obj = new DesignPattern_Bridge($classname, $attributes); |
| 67 |
|
|
| 68 |
|
// call constructor if possible |
| 69 |
|
// FIXME: take care for side-effects!!! |
| 70 |
|
/* |
| 71 |
|
if (method_exists($obj, 'constructor')) { |
| 72 |
|
$obj->constructor(); |
| 73 |
|
} |
| 74 |
|
*/ |
| 75 |
|
|
| 76 |
return $obj; |
return $obj; |
| 77 |
} |
} |
| 78 |
|
|