/[cvs]/nfo/php/libs/org.netfrag.glib/Class/Inner.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.glib/Class/Inner.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations)
Fri Mar 28 03:03:49 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
Changes since 1.7: +17 -94 lines
purged old code

1 <?
2 /**
3 * This file contains the Class::Inner class.
4 *
5 * @author Andreas Motl <andreas.motl@ilo.de>
6 * @package org.netfrag.glib
7 * @name Class::Inner
8 *
9 */
10
11 /**
12 * <b>Cvs-Log:</b>
13 *
14 * <pre>
15 * $Id: Inner.php,v 1.7 2003/03/11 02:28:11 joko Exp $
16 *
17 * $Log: Inner.php,v $
18 * Revision 1.7 2003/03/11 02:28:11 joko
19 * + fixed metadata for phpDocumentor
20 *
21 * Revision 1.6 2003/03/11 02:23:02 joko
22 * + fixed metadata for phpDocumentor
23 *
24 * Revision 1.5 2003/03/11 02:04:36 joko
25 * + fixed metadata for phpDocumentor
26 *
27 * Revision 1.4 2003/03/11 01:42:59 joko
28 * + fixed metadata for phpDocumentor
29 *
30 * Revision 1.3 2003/03/11 01:12:53 joko
31 * + fixed metadata for phpDocumentor
32 *
33 * Revision 1.2 2003/03/05 18:54:43 joko
34 * updated docu - phpDocumentor is very strict about its 'blocks'...
35 *
36 * Revision 1.1 2003/03/03 21:26:30 joko
37 * refactored from DesignPattern::Bridge
38 *
39 * Revision 1.5 2003/02/27 18:09:56 joko
40 * mungled mechanism to shift in and pass on arguments
41 *
42 * Revision 1.4 2003/02/09 17:07:53 joko
43 * + minor update related to new log level constants
44 * + generic argument merger to show full constructor args
45 *
46 * Revision 1.3 2003/02/03 14:46:57 joko
47 * + wrapped calls to available initializers (constructors, declared startup methods)
48 * - moved logger-code to DesignPattern::Logger
49 *
50 * Revision 1.2 2003/02/03 05:01:27 joko
51 * + now attributes can get passed in to the constructors
52 *
53 * Revision 1.1 2003/02/03 03:33:48 joko
54 * + initial commit
55 * </pre>
56 *
57 */
58
59 /**
60 * This requires DesignPattern::Facade as a base class
61 *
62 */
63 loadModule('DesignPattern::Facade');
64
65 /**
66 * Class::Inner
67 *
68 * @author Andreas Motl <andreas.motl@ilo.de>
69 * @copyright (c) 2003 - All Rights reserved.
70 * @license GNU LGPL (GNU Lesser General Public License)
71 *
72 * @link http://www.netfrag.org/~joko/
73 * @link http://www.gnu.org/licenses/lgpl.txt
74 *
75 * @package org.netfrag.glib
76 * @subpackage Class
77 * @name Class::Inner
78 *
79 */
80 class Class_Inner extends DesignPattern_Facade {
81
82 /*
83 var $_parent_class;
84 var $_inner_classes;
85 var $_inner_objects;
86 var $_call_constructor;
87 */
88
89 function perform($args) {
90 $this->__create_inners($args);
91 }
92
93 function __call_constructor($objectname, $method) {
94 if (method_exists($this->$objectname, $method)) {
95 $this->log( get_class($this) . "->__call_constructor: autocalling \$this->" . $objectname . "->$method()" );
96 $this->$objectname->$method();
97 }
98 }
99
100 function __create_inners($args) {
101
102 $this->log( get_parent_class($this) . "->__create_inners( parent='" . $args[parent_name] . "' )", PEAR_LOG_INFO );
103 //$this->log( get_parent_class($this) . "->_init_helpers: instantiating helper objects below '" . get_class($this) . "::'" );
104
105 //print Dumper($args);
106
107 foreach ($args[class_names] as $classname_inner) {
108
109 // build objectname from classname
110 // - make lowercase
111 // - strip leading "Xyz_" ('Site_' here)
112 $objectname = $classname_inner;
113 $objectname = str_replace('Site_', '', $objectname); // FIXME!!!
114 $objectname = strtolower($objectname);
115
116 // create new instance of helper object by classname
117 // V1:
118 //$this->$objectname = &$this->_mkInstance($classname_inner);
119
120 // V2:
121
122 /**
123 * <!-- Autodia -->
124 * can do: (this is metadata supplied for Autodia, don't delete!)
125 * $this->_locator = new $classname_inner()
126 *
127 */
128
129 $this->$objectname = &php::mkInstance($classname_inner);
130
131 // create additional references to helper object with other names if requested
132 // the intention is (e.g.) to migrate objects over to new reference-names when development progresses and ...
133 // ... refactoring the object hierarchy is needed, but ...
134 // ... you wanna provide the old reference names as "fallbacks" for old code using the libs
135 if (is_array($args[ref_names])) {
136 foreach ($args[ref_names] as $ref_name) {
137 //print "mkRef: $ref_name<br>";
138 $this->$ref_name = &$this->$objectname;
139 }
140 }
141
142 // helper gets reference to ourselves as a parent
143 $this->$objectname->$args[parent_name] = &$this;
144
145 $this->__call_constructor($objectname, 'constructor');
146 if ( $method = $args[run] ) {
147 $this->__call_constructor($objectname, $method);
148 }
149
150 }
151
152 }
153
154
155 }
156
157 ?>

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