/[cvs]/nfo/php/libs/org.netfrag.glib/DesignPattern/Object.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/DesignPattern/Object.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Mon Feb 3 03:33:48 2003 UTC revision 1.6 by joko, Fri Feb 28 04:18:13 2003 UTC
# Line 3  Line 3 
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
16    //  + minor fix: can seperate namespace identifier with slashes ('/') now
17    //
18    //  Revision 1.3  2003/02/09 17:16:06  joko
19    //  + handling arguments perl style ;-)
20    //
21    //  Revision 1.2  2003/02/03 05:01:48  joko
22    //  + now attributes can get passed in to the constructors
23    //
24  //  Revision 1.1  2003/02/03 03:33:48  joko  //  Revision 1.1  2003/02/03 03:33:48  joko
25  //  + initial commit  //  + initial commit
26  //  //
27  // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
28    
29    
   
30  /*  /*
31  class DesignPattern_Object {  class DesignPattern_Object {
32    function DesignPattern_Object() {    function DesignPattern_Object() {
# Line 25  function _ns2file($nsName) { Line 42  function _ns2file($nsName) {
42    }    }
43  }  }
44    
45  function mkObject($namespacedClassname) {  function mkObject() {
46      $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);
54      $namespacedClassname = array_shift($arg_list);
55      if (strstr($namespacedClassname, '_')) {
56        //print "mkObject: unallowed character in namespaced classname: '_' ($namespacedClassname)<br/>";
57        //return;
58      }
59      //print "class: $classname<br>";
60      $attributes = $arg_list;
61    $classname = $namespacedClassname;    $classname = $namespacedClassname;
62    if (loadModule($namespacedClassname)) {    if (loadModule($namespacedClassname)) {
63      $classname = str_replace('::', '_', $namespacedClassname);      $classname = str_replace('::', '_', $namespacedClassname);
64        $classname = str_replace('/', '_', $classname);
65    }    }
66    $obj = new DesignPattern_Bridge($classname);    $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    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed