| 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 | 
| 12 |  | //  re-allowed underscores ('_') in php classnames | 
| 13 |  | //  does this break something? | 
| 14 |  | // | 
| 15 | //  Revision 1.4  2003/02/22 16:34:16  joko | //  Revision 1.4  2003/02/22 16:34:16  joko | 
| 16 | //  + minor fix: can seperate namespace identifier with slashes ('/') now | //  + minor fix: can seperate namespace identifier with slashes ('/') now | 
| 17 | // | // | 
| 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, '_')) { | 
| 56 | print "mkObject: unallowed character in namespaced classname: '_' ($namespacedClassname)<br/>"; | //print "mkObject: unallowed character in namespaced classname: '_' ($namespacedClassname)<br/>"; | 
| 57 | return; | //return; | 
| 58 | } | } | 
| 59 | //print "class: $classname<br>"; | //print "class: $classname<br>"; | 
| 60 | $attributes = $arg_list; | $attributes = $arg_list; | 
| 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 |  |  |